
Research
SAP CAP npm Packages Hit by Mini Shai-Hulud Supply Chain Attack
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.
defaults-extender
Advanced tools
Fast, tiny and useful utility to extend options against defaults.
$ npm install defaults-extender
Easily extend object A with object B with a few fancy features. for example:
let's say you are building a command-line interface (CLI) and you have have something like this:
$ mycli --option.enabled true
but what you really want to do is.. if the user only sends --option true set the property enabled to true.
if you are to tackle with the command parser itself you end up with a "if else" hell in your file... or you start to create names like --optionEnabled true...
what if you could so something like this:
const extend = require('defaults-extender')
//or const { extend } = require('defaults-extender')
const defaults = {
options: {
enabled: false,
format: 'jpg',
size: 1024
}
}
let options = { options : true };
let result = extend(defaults, options);
// result in
result = {
options: {
enabled: true,
format: 'jpg',
size: 1024
}
}
so, all what you need to do is specify your defaults, and adhere to it, it will be how your final output will look like. for example this will not work:
const defaults = {
options: false
}
let options = {
options: {
enabled: true
}
}
let result = extend(defaults, options);
console.log(result.options.enabled) // undefined
To run the test suite, first install the dependencies, then run npm test:
$ npm install && npm test
To build from github, first clone this repo locally then run npm run build:
$ npm run build
FAQs
A different approach for extending Options against Defaults.
We found that defaults-extender 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.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.