Skip to content

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

License

Notifications You must be signed in to change notification settings

jonschlinkert/get-property

Repository files navigation

get-property NPM version

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

Related project

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'}

Install

Install with npm

npm i get-property --save

Install with bower

bower install get-property --save

Run tests

npm test

Author

Jon Schlinkert

License

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


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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published