Find a value inside an object namespace
example:
const findNamespaceValue = ;const obj = company: name: '1stdibs' ;const companyName = ;const companyLocation = ;const companySecrets = ; console; // => "1stdibs"console; // => "New York, NY"console; // => undefined
By just requiring the module by its name, it will by default give you the transpiled file. If you want to require the es6 version, you must use:
const = findNamespaceValue = ;
Keep in mind that that file is not transpiled. If you are not running your code through a transpiler like Babel or Traceur, then this will throw an error in the browser and you should just require the package instead.
testing:
$ npm install$ npm test
Usage
A single object
is passed in as options
:
@param object options@param String optionsns Period delimited string representing the property to search for ie "my.name.space"@param Object optionsparent={} defaults to the window object as the object to iterate over@param * optionsfallback=undefined A fallback value if `options.ns` is not found@param boolean optionsclone=false Clone the returned value if it is an object or an array@returns * Whatever the property value is or whatever is defined in the `options.fallback` param otherwise `undefined`