
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
set-options
Advanced tools
Merges default options to the user-given options.
$ npm install set-options --save
Always returns an object,
var set = require('set-options')
var defaults = {
a: 1
}
function factory (options) {
var config = set(options, defaults)
// `options` and `defaults` will not be ruined after `set()`
console.log(config, config === options, config === defaults)
}
factory()
// {a: 1} false false
factory(undefined)
// {a: 1} false false
factory(null)
// {a: 1} false false
factory(1)
// {a: 1} false false
factory({})
// {a: 1} false false
factory({b: 1})
// {a: 1, b: 1} false false
factory({a: 0})
// {a: 1} false false
Object=
can be undefined.Object
not defining defaults
is silly, since that's the whole purpose of this lib.set(options, defaults, filter)
var options = set({a: undefined}, {a: 1}, function (value, key, object) {
return key in object
})
options // {a: undefined}
## License
MIT
FAQs
Merges default options to the user-given options.
The npm package set-options receives a total of 15 weekly downloads. As such, set-options popularity was classified as not popular.
We found that set-options 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.