Skip to content
This repository has been archived by the owner on Dec 23, 2018. It is now read-only.

crcn/dref.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"]

About

deep object referencing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published