1.0.8 • Published 6 months ago

getv v1.0.8

Weekly downloads
3
License
ISC
Repository
-
Last release
6 months ago

getv

Get a value from an object by its path.

Intro

Not only getv is a drop-in replacement of lodash.get method, but it does it twice as fast (check benchmark.js file) and also takes half of its size.

Installation

  • npm - npm i getv -S

Usage

const getv = require('getv');

const object = {
  foo: {
    bar: 1,
  },
  baz: 5,
  lor: ['mir', 'dal'],
};

getv(object, 'none.bar');             // => undefined

getv(object, 'none.bar', 'default');  // => 'default'

getv(object, 'baz');                  // => 5

getv(object, 'foo.bar');              // => 1

getv(object, 'lor.1');                // => 'dal'
1.0.8

6 months ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago