Package Exports
- jaunt
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jaunt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Jaunt.js

Get or set a value in an object or array using a dot-delimited string.
Usage
Get:
var obj = {
foo: {
bar: ['Hello', 'World']
}
};
jaunt.get(obj, 'foo.bar.0'); //=> 'Hello'
jaunt.get(obj, ['foo', 'bar', 1]); //=> 'World'
jaunt.get(obj, 'invalid'); //=> undefined
Set:
var obj = {
foo: {
bar: ['Hello', 'World']
}
};
jaunt.set(obj, 'foo.bar.0', 'Goodbye');
/* =>
* {
* foo: {
* bar: ['Goodbye', 'World']
* }
* }
*/
Go!
API
jaunt.get(obj, path)
Returns the value in obj
corresponding to path
. Returns undefined
if path
does not exist.
obj
is anobject
or anarray
.path
is a dot-delimitedstring
of keys, or anarray
of keys.
jaunt.set(obj, path, val)
Sets the element corresponding to path
in obj
to the specified val
. Returns the obj
.
obj
is anobject
or anarray
.path
is a dot-delimitedstring
of keys, or anarray
of keys.
Installation
Install via npm:
$ npm i --save jaunt