Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 3.141.164.253
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
unp-musonza /
node_modules /
object-path /
Delete
Unzip
Name
Size
Permission
Date
Action
.npmignore
75
B
-rwxr-xr-x
2014-07-09 07:30
.travis.yml
271
B
-rwxr-xr-x
2015-04-16 08:47
LICENSE
1.05
KB
-rwxr-xr-x
2014-07-09 07:30
README.md
2.96
KB
-rwxr-xr-x
2015-04-16 08:48
bower.json
219
B
-rw-r--r--
2015-01-29 10:07
component.json
456
B
-rw-r--r--
2014-11-17 10:39
index.js
6.1
KB
-rw-r--r--
2015-03-19 13:28
package.json
1.66
KB
-rwxr-xr-x
2021-02-04 21:24
test.js
19.8
KB
-rw-r--r--
2015-03-19 13:28
Save
Rename
object-path =========== Access deep properties using a path [](http://badge.fury.io/js/object-path) [](https://travis-ci.org/mariocasciaro/object-path) [](https://coveralls.io/r/mariocasciaro/object-path) [](https://david-dm.org/mariocasciaro/object-path#info=devDependencies)  ## Install ### Node.js ``` npm install object-path ``` ### Browser ``` bower install object-path ``` ### Typescript typings ``` tsd query object-path --action install --save ``` ## Usage ```javascript var obj = { a: { b: "d", c: ["e", "f"] } }; var objectPath = require("object-path"); //get deep property objectPath.get(obj, "a.b"); //returns "d" //get the first non-undefined value objectPath.coalesce(obj, ['a.z', 'a.d', ['a','b']], 'default'); //empty a given path (but do not delete it) depending on their type,so it retains reference to objects and arrays. //functions that are not inherited from prototype are set to null. //object instances are considered objects and just own property names are deleted objectPath.empty(obj, 'a.b'); // obj.a.b is now '' objectPath.empty(obj, 'a.c'); // obj.a.c is now [] objectPath.empty(obj, 'a'); // obj.a is now {} //works also with arrays objectPath.get(obj, "a.c.1"); //returns "f" objectPath.get(obj, ["a","c","1"]); //returns "f" //can return a default value with get objectPath.get(obj, ["a.c.b"], "DEFAULT"); //returns "DEFAULT", since a.c.b path doesn't exists, if omitted, returns undefined //set objectPath.set(obj, "a.h", "m"); // or objectPath.set(obj, ["a","h"], "m"); objectPath.get(obj, "a.h"); //returns "m" //set will create intermediate object/arrays objectPath.set(obj, "a.j.0.f", "m"); //will insert values in array objectPath.insert(obj, "a.c", "m", 1); // obj.a.c = ["e", "m", "f"] //push into arrays (and create intermediate objects/arrays) objectPath.push(obj, "a.k", "o"); //ensure a path exists (if it doesn't, set the default value you provide) objectPath.ensureExists(obj, "a.k.1", "DEFAULT"); //deletes a path objectPath.del(obj, "a.b"); // obj.a.b is now undefined objectPath.del(obj, ["a","c",0]); // obj.a.c is now ['f'] //tests path existence objectPath.has(obj, "a.b"); // true objectPath.has(obj, ["a","d"]); // false //bind object var model = objectPath({ a: { b: "d", c: ["e", "f"] } }); //now any method from above is supported directly w/o passing an object model.get("a.b"); //returns "d" model.get(["a.c.b"], "DEFAULT"); //returns "DEFAULT" model.del("a.b"); // obj.a.b is now undefined model.has("a.b"); // false ``` ### Credits * [Mario Casciaro](https://github.com/mariocasciaro) - Author * [Paulo Cesar](https://github.com/pocesar) - Major contributor