How to use the object-path.push function in object-path

To help you get started, we’ve selected a few object-path 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 Autodesk / clearx / src / store.js View on Github external
push (key /*, values */) {
    let args = [this.data, key]
    args.push.apply(args, Array.prototype.slice.call(arguments, 1))
    objectpath.push.apply(objectpath, args)
    this.handler.changed([key])
  }
  // ensure a path exists (if it doesn't, set the default value you provide)
github eduardoboucas / static-api-generator / lib / io.js View on Github external
walker.on('file', (root, stat, next) => {
      if (stat.name.indexOf('.') === 0) return next()

      const basePath = root.split('/').slice(1).join('.')
      const filePath = path.relative(
        directory,
        path.join(root, stat.name)
      )

      objectPath.push(tree, basePath, filePath)

      paths[filePath] = {
        file: true
      }

      next()
    })
github lucasconstantino / graphql-resolvers / src / dependingResolvers.js View on Github external
(value, args, context, info) => (
    push(context, '_dependees', { path: info.path, value }), value
  )
)
github willrstern / rules-runner / lib / Rules.js View on Github external
Rules.prototype.runOutcomes = function (outcomes, data) {
  var outcomeKey;
  var keys = Object.keys(outcomes);
  //if any test is false, return
  for (var i = 0; i < keys.length; i++) {
    //handle arrays
    if (keys[i].slice(-2) === "[]") {
      outcomeKey = keys[i].slice(0, keys[i].length - 2);
      path.push(data, outcomeKey, outcomes[keys[i]]);
    } else {
      path.set(data, keys[i], outcomes[keys[i]]);
    }
  }

  return data;
};