A Nodejs module to manipulate objects like a folder
Install
$ npm install --save pathme
Usage
var pathme = ; var myObj = foo : bar : 'a''b''c' pi : ka: chu : 'chuuuuuuuu' ; var pathObj = ;
or just simply
var pathObj = myObj;
- move to a given attribute
pathObjcwd == 'chuuuuuuuu'pathObjcwd == 'a' //You can even play with tree-climbing: pathObjcwd == myObjpikachu ;pathObjcwd == myObj;pathObjcwd == myObj; //or chaining calls pathObjcwd == myObjpikachu;pathObj == myObj; //Shell user would be familiar with pushd/popd commands pathObjcwd == myObjfoobar; // move to foo/bar and save path to stack; pathObjcwd == myObjpika; // move to /pi/ka and save path to stack; pathObjcwd == myObj; // save current path to stack pathObjcwd == myObjpikachu; pathObjcwd == myObj;pathObjcwd == myObjpika;pathObjcwd == myObjfoobar;
- test if a given attribute exists
//Testing from "root folder" pathObj == true;pathObj == false;pathObj == false; //Or from a nested objectpathObj == false
Run tests
From package root:
$> npm install$> npm test
License
MIT © p418