0.1.2 • Published 11 years ago

dref v0.1.2

Weekly downloads
4,243
License
-
Repository
github
Last release
11 years ago

Features

  • Ability to deep reference an object
  • Ability to scan arrays, and return an array of values, e.g, users.$.name.

Usage

var dref = require("dref");

var target = [
	{
		name: "Craig", 
		location: {
			city: "minneapolis"
		}
	},
	{
		name: "Tim", 
		location: {
			city: "St. Paul"
		}
	}
];


console.log(dref.get(target, '$.name')); //["Craig", "Tim"]
console.log(dref.get(target, '$.location.city')); //["Minneapolis", "St. Paul"]
dref.set(target, '$.name', "BLAH");
console.log(dref.get(target, '$.name')); //["BLAH", "BLAH"]