New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fast-get

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-get

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

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

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-get220 bytes612,000 ops/sec571,000 ops/sec
lodash.get2,145 bytes810,000 ops/sec200,000 ops/sec

Licence

MIT

Keywords

object

FAQs

Package last updated on 12 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts