A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ayushgp/deep-object below:

GitHub - ayushgp/deep-object

A CRUD API to manipulate objects in depth. Get, Set, Update and Delete functions available.

With npm

var deepObj = require('deep-object');
var obj = {
  level1:{
    level2:{
      level3:{
        name: "Foo"
      }
    },
    anotherLevel2: "bar"
  }
};

deepObj.get(obj, ["level1", "level2"]); //returns {level3: {name: "Foo"}}

deepObj.set(obj, ["level1", "level2"], "FooBar"); //Sets level2 to "FooBar"

deepObj.remove(obj, ["level1", "level2"]); //Object now becomes, {level1: {}}
deepObj.get(object, path);

Gets the value at the given path

deepObj.set(object, path, value);

Sets/updates given value at the path.

deepObj.remove(object, path);

Removes the given path element.

I needed this for a project. Didn't look through NPM for this. Here is my implementation.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4