@drm2/dig.js

0.0.2 • Public • Published

dig.js

Bring Ruby's Hash#dig method to JavaScript/Node.

usage

You can use this library as a method of Object to make things more natural, or you can just use it as a standalone function.

as a method on Object

example

require('@drm2/dig.js').init();

var test = { hello: { world: '!' } };

test.dig('hello', 'world'); // returns '!'

test.dig('fake', 'props'); // returns null

as a standalone function

example

var dig = require('@drm2/dig.js').dig;

var test = { hello: { world: '!' } };

dig(test, 'hello', 'world'); // returns '!'

dig(test, 'fake', 'props'); // returns null

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    1

Package Sidebar

Install

npm i @drm2/dig.js

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • drm2