JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2184090
  • Score
    100M100P100Q199334F
  • License MIT

Access deep properties using a path

Package Exports

  • object-path

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM

Build Status

object-path

Access deep properties using a path

var obj = {
  a: {
    b: "d",
    c: ["e", "f"]
  }
};

var objectPath = require("object-path");

//get deep property
objectPath.get(obj, "a.b");  //returns "d"

//works also with arrays
objectPath.get(obj, "a.c.1");  //returns "f"

//set
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");

//push into arrays
objectPath.push(obj, "a.k", "o");