
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
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.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.