How to use for-in - 1 common examples

To help you get started, we’ve selected a few for-in examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tunnckoCore / parse-function / test / index.js View on Github external
function factory (parserName, parseFn) {
  forIn(actuals, (values, key) => {
    values.forEach((code, i) => {
      const actual = parseFn(code)
      const expect = expected[key][i]
      const value = actual.value.replace(/^\(\{? ?/, '').replace(/\)$/, '')

      test(`#${testsCount++} - ${parserName} - ${value}`, (done) => {
        test.strictEqual(actual.isValid, true)
        test.strictEqual(actual.name, expect.name)
        test.strictEqual(actual.body, expect.body)
        test.strictEqual(actual.params, expect.params)
        test.deepEqual(actual.args, expect.args)
        test.deepEqual(actual.defaults, expect.defaults)
        test.ok(actual.value)
        done()
      })
    })

for-in

Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js

MIT
Latest version published 8 years ago

Package Health Score

68 / 100
Full package analysis

Popular for-in functions