Notation.js
for Node and Browser.

© 2017, Onur Yıldırım (@onury). MIT License.
Utility for modifying / processing the contents of Javascript objects by parsing object notation strings or globs.
Note that this library will only deal with enumerable properties of the source object; so it should be used to manipulate data objects. It will not deal with preserving the prototype-chain of the given object.
Usage
Install via NPM:
npm i notation --save
var Notation = require('notation');
var obj = { car: { brand: "Dodge", model: "Charger" }, dog: { breed: "Akita" } };
var notation = new Notation(obj);
notation.get('car.model');
notation
.set('car.color', 'red')
.remove('car.model')
.filter(['*', '!car'])
.flatten()
.expand()
.merge({ 'dog.color': 'white' })
.copyFrom(other, 'boat.name')
.rename('boat.name', 'dog.name')
.value;
Documentation
You can read the full API reference here.
Change-Log
1.3.0 (2017-09-30)
- Completely re-wrote
Notation.Glob.union()
static method.
- Fixed the array mutation issue. Fixes issue #2.
- Fixed an issue where a glob with wildcard is not properly union'ed. Fixes issue #3.
sort
(boolean
) argument is removed (the output is now always sorted.)- Union output is now properly normalized, duplicates and redundant globs are removed, etc...
- Fixed an issue where negated wildcards would be filtered incorrectly in some edge cases (e.g.
!*.*.*
). - Added
Notation.Glob.normalize(array)
static method. - Added
Notation.Glob.toRegExp(glob)
static method. - Aded
Notation.countNotes(notation)
convenience method. - Improved glob validation.
- Fix import typo that prevents Travis builds succeed.
- Minor revisions, clean-up.
- (dev) Removed dev-dependencies (Grunt and plugins) in favor of NPM scripts. Updated other dev-dependencies. Added more, comprehensive tests.
1.1.0 (2016-09-27)
- Added
Notation#expand()
method (alias Notation#aggregate()
). - Refactored
Notation#getFlat()
to Notation#flatten()
. Returns instance (chainable) instead of source. Notation#separate()
returns instance (chainable) instead of source.- Minor revisions.
v1.0.0 (2016-04-10)
License
MIT.