
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
object-funcs
Advanced tools
A very limited subset of object functions I use every day
npm i object-funcs
Package on npm
Return the first defined arg
arg is considered not defined when
arg is nullarg is undefinedarg is NaNconst defined = require('object-funcs/defined')
var opts = {y:false, w:4}
// false
defined(opts.x, opts.y, 100)
// 'yes'
defined(null, undefined, NaN, 'yes')
Merge properties of a Plain Object or a serie of Plain Objects into a new one
const merge = require('object-funcs/merge')
var ref = {a:'foo'}
// {a:'foo', b:'bar'}
var obj = merge(ref, {b:'bar'})
// {a:'foo'}
ref
Always overwrite properties
const merge = require('object-funcs/merge')
// {a:'foo', b:'baz', c:'quux'}
merge({a:'foo'}, {b:'bar'}, {b:'baz'}, {c:'quux'})
No deep merge, only first level of properties are injected
const merge = require('object-funcs/merge')
var ref = {foo:{bar:'baz'}}
// {foo:{bar:'baz'}, a:1}
merge(ref, {a:1})
// {foo:{b:2}}
merge(ref, {foo:{b:2}})
Return a new Plain Object with filtered properties
keys can be a String or an Array of targeted keys
keys can also be a RegExp
const only = require('object-funcs/only')
// {a:1, b:2}
only({a:1, b:2, c:3}, 'a b')
// {b:2, c:3}
only({a:1, b:2, c:3}, ['b', 'c'])
// {bar:1, baz:2}
only({foo:0, bar:1, baz:2, quux:3}, /^ba/)
Partial comparison of two objects
Check if the keys / values in search are equals in obj
const similar = require('object-funcs/similar')
// true
similar({foo:'bar', baz:54}, {baz:54})
// false
similar({foo:'bar', baz:54}, {baz:54, a:1})
// true
similar({foo:{bar:{baz:'quux', c:3}, b:2}, a:1}, {foo:{bar:{baz:'quux'}}})
Mainly forked / inspired on
MIT
FAQs
A very limited subset of object functions I use every day
The npm package object-funcs receives a total of 18 weekly downloads. As such, object-funcs popularity was classified as not popular.
We found that object-funcs 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.