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

getv

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getv

Get a value from an object by its path

latest
npmnpm
Version
1.1.1
Version published
Weekly downloads
9
50%
Maintainers
0
Weekly downloads
 
Created
Source

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'],
  boo: [
    { id: 1 },
    { id: 2 },
  ],
};

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'

getv(object, 'boo.id');                // => [1, 2]

FAQs

Package last updated on 09 Jul 2024

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