
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
@strikeentco/get
Advanced tools
Get a property from a nested object using a dot path or custom separator
One of the smallest (23 sloc) and most effective implementations of getting a nested value from an object.
$ npm install @strikeentco/get --save
const get = require('@strikeentco/get');
get({ a: { b: 'c' } }, 'a.b');
//=> 'c'
get({ a: { b: ['c', 'd'] } }, 'a.b.1');
//=> 'd'
get({ a: { b: ['c', 'd'] } }, ['a', 'b']);
//=> ['c', 'd']
get({ a: { b: 'c' } }, 'a.b.c.d');
//=> undefined
get({ a: { b: 'c' } }, 'a:b', ':');
//=> 'c'
.
by default.(benchmarks were run on a Intel Core i5-6200U @ 2.30 GHz, 8 GB 2133 MHz DDR4)
# deep.js (175 bytes)
dot-prop x 633,102 ops/sec ±1.19% (85 runs sampled)
get-value x 1,138,909 ops/sec ±1.80% (87 runs sampled)
get x 2,066,525 ops/sec ±0.99% (90 runs sampled) - this library
getobject x 170,159 ops/sec ±1.17% (88 runs sampled)
lodash.get x 1,847,112 ops/sec ±0.60% (89 runs sampled)
object-path x 126,724 ops/sec ±2.33% (86 runs sampled)
fastest is get - this library
# root.js (210 bytes)
dot-prop x 3,056,017 ops/sec ±1.84% (86 runs sampled)
get-value x 11,121,668 ops/sec ±1.04% (87 runs sampled)
get x 4,160,982 ops/sec ±1.06% (88 runs sampled) - this library
getobject x 1,004,785 ops/sec ±1.19% (88 runs sampled)
lodash.get x 6,529,634 ops/sec ±0.69% (90 runs sampled)
object-path x 1,976,993 ops/sec ±1.97% (86 runs sampled)
fastest is get-value
# shallow.js (84 bytes)
dot-prop x 1,965,057 ops/sec ±1.64% (89 runs sampled)
get-value x 2,697,800 ops/sec ±1.13% (87 runs sampled)
get x 3,529,218 ops/sec ±1.13% (87 runs sampled) - this library
getobject x 576,927 ops/sec ±1.04% (88 runs sampled)
lodash.get x 3,145,038 ops/sec ±2.11% (87 runs sampled)
object-path x 595,264 ops/sec ±3.33% (82 runs sampled)
fastest is get - this library
Benchmark from jonschlinkert/get-value
library.
The MIT License (MIT)
Copyright (c) 2018 Alexey Bystrov
FAQs
Get a property from a nested object using a dot path or custom separator
The npm package @strikeentco/get receives a total of 2,545 weekly downloads. As such, @strikeentco/get popularity was classified as popular.
We found that @strikeentco/get demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.