fast-get

1.0.5 • Public • Published

fast-get

Build Status Coverage Status Greenkeeper badge

Gets the value at path of object (with an optional default)

Install

npm install fast-get

This module can be used for Node.js as well as browsers using Browserify.

Usage

const _get = require('fast-get')
 
const object = {a: [{b: {c: 3}}]}
 
_get(object, 'a[0].b.c')
// => 3
 
_get(object, ['a', '0', 'b', 'c'])
// => 3
 
_get(object, 'a.b.c', 'default')
// => 'default'

Tests

npm test

Benchmark

npm run benchmark
Size (uglify + gzip) Performance (array) Performance (string)
fast-get 220 bytes 612,000 ops/sec 571,000 ops/sec
lodash.get 2,145 bytes 810,000 ops/sec 200,000 ops/sec

Licence

MIT

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i fast-get

    Weekly Downloads

    191

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    10.1 kB

    Total Files

    7

    Last publish

    Collaborators

    • queicherius