Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Unpartial an interface
It is very common to define a config interface and Partial<>
it in a function argument.
When we received the arguement, we want to merge it with our default config before using it:
import { unpartial } from 'unpartial'
interface Config {
require: { a: number }
optional?: { a: number }
}
const defaultConfig = { require: { a: 1 } }
function foo(givenConfig: Partial<Config>) {
const config = unpartial(defaultConfig, givenConfig);
// use config with type safety
}
Code complete is avaiable as you type:
const config = unpartial(defaultConfig, { /* code completion here */});
It also supports merging two default configs. This is useful when you are extending interface from another package/class.
import { unpartial } from 'unpartial'
import { Option, defaultOption } from 'another-package'
interface MyOption extends Option { ... }
const myDefaultOption = { ... }
function foo(givenOption: Partial<MyOption>) {
const option = unpartial(defaultOption, myDefaultOption, givenOption)
}
# right after fork
npm install
# begin making changes
npm run watch
FAQs
Unpartial a partialed object
We found that unpartial 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.