JSPM

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

Get or set a property from a nested object using a dot path

Package Exports

  • dot-prop

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 (dot-prop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dot-prop Build Status

Get or set a property from a nested object using a dot path

Install

$ npm install --save dot-prop

Usage

var dotProp = require('dot-prop');

// getter
dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar');
//=> 'unicorn'

dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep');
//=> undefined

// setter
var obj = {foo: {bar: 'a'}};
dotProp.set(obj, 'foo.bar', 'b');
console.log(obj);
//=> {foo: {bar: 'b'}}

dotProp.set(obj, 'foo.baz', 'x');
console.log(obj);
//=> {foo: {bar: 'b', baz: 'x'}}

License

MIT © Sindre Sorhus