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

oget

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oget

fast { property: 'getter' }

latest
Source
npmnpm
Version
1.1.5
Version published
Weekly downloads
18
Maintainers
1
Weekly downloads
 
Created
Source

oget

fast { property: 'getter' }

How fast is it

Well, I didn't do any extensive testing on all available browsers, but since it uses only builtin functions it should be quite fast. According to this little benchmark it is currently faster than lodash.get on the current LTS version of node.js.

What this is not

This will never be some kind of "wannabe" lodash killer library. It's just what you see - a simple object property getter.

Usage

import oget from 'oget';

const obj = {
  uno: 1,
  due: {
    a: ['abracadabra'],
    b: [ [ [ 'horray' ] ] ]
  },
  tre: 3
};

oget(obj, 'due.a.0'); // abracadabra
oget(obj, '[due][a[0]]'); // abracadabra
oget(obj, 'due.a[0]'); // abracadabra

oget(obj, 'due.b[0][0][0]'); // horray
oget(obj, 'due.b.0.0.0'); // horray
oget(obj, 'due[b].0[0].0'); // horray

oget(obj, 'due.b.0.0[0].missing', 'default_value!'); // default_value!

Install

$ npm install --save oget

Test

$ npm install && npm test

Keywords

get

FAQs

Package last updated on 01 Feb 2021

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