alanning:resolve

v0.0.1Published 8 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Resolve a value given an object and a path representing how to traverse its object graph.

Can also set values on existing objects.

Example

var obj = {
  foo: [
    {bar: "baz"}
  ]
};

Util.resolve(obj, "foo[0].bar");   // => "baz"
Util.resolve(obj, "hem[0].bar");   // => undefined
Util.resolve(obj, "name", "Mary");   // => "Mary"