npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

get-property

0.2.0

@jonschlinkert

npmHomeRepoSnykSocket
Downloads:23
$ npm install get-property
DailyWeeklyMonthlyYearly

get-property NPM version

Get a nested property or its value from an object using simple a.b.c paths.

Install

Install with npm:

npm i get-property --save-dev

Run tests

npm test

Usage

var get = require('get-property');

Examples

var obj = {a: 'a', b: {c: 'd'}};

get(obj, 'b.c');
//=> {c: 'd'}

get({a: 'a', b: 'b'}, 'a');
//=> {a: 'a'}

get({a: 'a', b: {c: 'd'}}, 'b.c');
//=> {c: 'd'}

get({a: {b: 'c', c: {d: 'e', e: 'f', g: {h: 'i'}}}}, 'a.c.g.h');
//=> {h: 'i'}

Author

Jon Schlinkert

  • github/jonschlinkert
  • twitter/jonschlinkert

Related repos

Other javascript/node.js object utils that I maintain:

  • for-in
  • for-own
  • has
  • has-any
  • has-value
  • is-plain-object
  • object-pick
  • omit-empty
  • reduce-object

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on October 08, 2014.