
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.
default-options
Advanced tools
Assigns default values to an object along with validating for required and unknown property keys.
Assigns default values to an object along with validating for required and unknown property keys.
dopts(options, defaults, [doptsOptions]);
options - The user specified options objectdefaults - An object of defaults for values not specified in options. If a default property value is set specifically to undefined, it will be treated as a required property.doptsOptions - Optional object of options for the dopts function.
doptsOptions.allowUnknown If set to true, will not throw an error if an unknown property is specified. (default is false)defaults merged with optionsExample:
var dopts = require('default-options');
dopts({foo: 1, bar: 1}, {
foo: undefined, // undefined means required
bar: 2, // optional
baz: null, // optional
});
// Returns {foo: 1, bar: 1, baz: null}
dopts({foo:1}, {
foo: undefined,
bar: undefined
});
// Throws an Error because `bar` is not defined
dopts({foo: 1, biz: 2}, {
foo: undefined
});
// Throws an Error because `biz` is an unknown property
FAQs
Assigns default values to an object along with validating for required and unknown property keys.
The npm package default-options receives a total of 231 weekly downloads. As such, default-options popularity was classified as not popular.
We found that default-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
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.