can.getObject

  • function
 

can.getObject(name, roots, add)

Gets an object from a string.

Parameters

  1. name {String}

    the name of the object to look for

  2. roots {Array}Optional

    an array of root objects to look for the name. If roots is not provided, the window is used.

  3. add {Boolean}Optional

    true to add missing objects to the path. false to remove found properties. undefined to not modify the root object

Returns

{Object}

The object.

Gets an object from a string. It can also modify objects on the 'object path' by removing or adding properties.

Foo = {Bar: {Zar: "Ted"}}
can.getObject("Foo.Bar.Zar") //-> "Ted"