![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Set object values using property chaining syntax.
Support this project by ⭐️ starring and sharing it. Follow me to see what other cool projects I'm working on! ❤️
Setting a value on an arbitrary nested path can be cumbersome to do correctly.
For example, someObject.propA.propB.propC = 'value'
on a potentially empty someObject
requires a guard for each nested property.
chainset
const someObject = {}
if (!Object.hasOwn(someObject, 'propA')) {
someObject.propA = {}
}
if (!Object.hasOwn(someObject.propA, 'propB')) {
someObject.propA.propB = {}
}
someObject.propA.propB.propC = 'value'
chainset
const someObject = chainset()
someObject.propA.propB.propC = 'value'
import chainset from 'chainset'
const object = chainset() // => {}
// Automatically initializes 'propB' & 'propC' to objects
object.propA.propB.propC = 'value'
console.log(object)
/*
{
propA: {
propB: {
propC: 'value'
}
}
}
*/
const object = chainset({
foo: {
bar: {}
}
})
// Automatically initializes 'propA' & 'propB' to objects
object.foo.bar.propA.propB = 'value'
console.log(object)
/*
{
foo: {
bar: {
propA: {
propB: 'value'
}
}
}
}
*/
Type: object
Default: Object.create(null)
(a pure, prototype-less object)
The object to ehance with "chain-setting" support.
Type: boolean | number
Default: true
How deep to add automatic object initialization support on access. Set to true
to add support infinitely. Set a number to limit the depth of objects to add support to. Set to false
to only add support to the immediate object.
Type: RegExp | (string|RegExp)[] | (path, object) => boolean
A regular expression pattern, array of strings/patterns, or function that restrict what property names will be initialized on access.
Type: (key?: string) => object
Default: () => Object.create(null)
A function that creates a new object to use when a property is accessed.
FAQs
Set object values using property chaining syntax
The npm package chainset receives a total of 0 weekly downloads. As such, chainset popularity was classified as not popular.
We found that chainset 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.