
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
objectools
Advanced tools
Useful easy-to-use utilities for JavaScript objects
.filter().map(), .mapKeyValue.keys, .values, .entries, .length.find(), .findIndex(), .findKey(), .findValue().findLast(), .findLastIndex(), .findLastKey(), .findLastValue().indexOf(), .lastIndexOf(), .indexOfKey().sort(), .sortByValues().some(), .every().omit().flip().reverse().transpose()o(obj).filter(...)).length.keys, .values, .entriesSet instead
of Array for .keys (
see: Why does Object.keys() return an Array instead of
a Set?)npm i objectools
or:
yarn add objectools
import o from 'objectools'
o({a: 1, b: 2, c: 3}).filter(/*...*/)
o({a: 1, b: 2, c: 3}).map(/*...*/)
o({a: 1, c: 3, b: 2}).sort()
o({...}) //...
// Or chain methods:
o({...}).oFilter(/*...*/).oMap(/*...*/).sort() // Don't prefix the last one with `o`.
// I.e. don't write `.oSort()` if you don't want to countinue the chain.
.filter()o({a: 1, b: 2, c: 3}).filter((value) => value > 1) // {b: 2, c: 3}
o({a: 1, b: 2, c: 3}).filter((_, key, index) => key < 'c' && index > 0) // {b: 2}
.map()o({a: 1, b: 2, c: 3}).map((value) => value * 2) // {a: 2, b: 4, c: 6}
o({a: 1, b: 2, c: 3}).mapKeyValue((value, key) => [key.toUpperCase(), value - 1]) // {A: 0, B: 1, C: 2}
.keys, .values, .entries, .lengtho({a: 1, b: 2, c: 3}).keys // Set {'a', 'b', 'c'} // Type: `Set<'a' | 'b' | 'c'>`
o({a: 1, b: 2, c: 3}).values // [1, 2, 3] // Type: `number[]`
o({a: 1, b: 2, c: 3}).entries // [['a', 1], ['b', 2], ['c', 3]] // Type: ['a' | 'b' | 'c', number][]
o({a: 1, b: 2, c: 3}).length // 3
.find(), .findIndex(), .findKey(), .findValue()o({a: 1, b: 2, c: 3}).find((value) => value > 1) // ['b', 2]
o({a: 1, b: 2, c: 3}).findIndex((value) => value > 1) // 1
o({a: 1, b: 2, c: 3}).findKey((value) => value > 1) // 'b'
o({a: 1, b: 2, c: 3}).findValue((value) => value > 1) // 2
.findLast(), .findLastIndex(), .findLastKey(), .findLastValue()o({a: 1, b: 2, c: 3}).findLast((value) => value > 1) // ['c', 3]
o({a: 1, b: 2, c: 3}).findLastIndex((value) => value > 1) // 2
o({a: 1, b: 2, c: 3}).findLastKey((value) => value > 1) // 'c'
o({a: 1, b: 2, c: 3}).findLastValue((value) => value > 1) // 3
.indexOf(), .lastIndexOf(), .indexOfKey()o({a: 3, b: 3}).indexOf(3) // 0
o({a: 3, b: 3}).lastIndexOf(3) // 1
o({a: 3, b: 3}).indexOfKey('b') // 1
.sort(), .sortByValues()o({b: 1, a: 3, c: 2}).sort() // {a: 3, b: 1, c: 2}
o({b: 1, a: 3, c: 2}).sortByValues() // {b: 1, c: 2, a: 3}
.some(), .every()o({a: 1, b: 2, c: 3}).some((value) => value > 1) // true
o({a: 1, b: 2, c: 3}).every((value) => value > 1) // false
.omit()o({a: 1, b: 2, c: 3}).omit('b') // {a: 1, c: 3}
o({a: 1, b: 2, c: 3}).omit('c', 'a') // {b: 2}
.flip()o({a: 'x', b: 'y'}).flip() // {x: 'a', y: 'b'}
.reverse()o({a: 'x', b: 'y'}).reverse() // {b: 'y', a: 'x'}
o({b: 1, a: 2, c: 3})
.oFilter((value) => value < 3)
.oMap((value) => value * 2)
.sort()
// --> {a: 4, b: 2}
.transpose()o({
x: {a: 1, b: 2},
y: {a: 3, b: 4},
z: {a: 5, b: 6},
}).transpose()
// -->
// {
// a: {x: 1, y: 3, z: 5},
// b: {x: 2, y: 4, z: 6},
// }
You may need to add this to your "jest.config.js" file:
export default {
transformIgnorePatterns: [
// These packages are created based on modern javascript and use ESM module system (import/export). But Jest use
// old common-js module-system. So we need to transform these files using babel, too (like source files). Note that
// "node_modules" folder is ignored by default, and we've EXCLUDED these packages from this general rule (see `?!`
// in the below regex).
'/node_modules/(?!(objectools)/)',
}
FAQs
Useful easy-to-use utilities for JavaScript objects
We found that objectools 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.