![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.
Precondition checks for Node.js inspired by Guava's precondition checking utilities.
npm install precond
npm test
Precond provides a set of functions to verify arguments and state correctness
It lets you rewrite constructs like the following
if (!this.isConnected) {
throw new Error('Client should be connected before calling X.');
}
into a more compact and declarative check bellow.
precond.checkState(this.isConnected, 'Client should be ...');
Note that even though the throw statement is wrapped in a function, the call stack will still start from the calling function. So the previous examples would both produce the same stack trace.
All arguments after the message will be used to format the actual error message that will be thrown.
The following precondition checks are provded:
Ensures that value is true. Throws an IllegalArgumentError
if value
is false.
Ensures that value is true. Throws an IllegalStateError
if value
is false.
Ensures that value is defined (could be null). Throws an
IllegalArgumentError
if value is undefined. Returns the value of
the value that was validated.
Ensures that value is defined and not null. Throws an
IllegalArgumentError
if value is undefined or null. Returns the value of
the value that was validated.
Ensures that value is a string or a String object. Throws an
IllegalArgumentError
if value isn't a string. Returns the value of
the value that was validated.
Ensures that value is an array. Throws an IllegalArgumentError
if
value isn't an array. Returns the value of the value that was
validated.
Ensures that value is a number. Throws an IllegalArgumentError
if
value isn't a number. Returns the value of the value that was
validated.
Ensures that value is a boolean. Throws an IllegalArgumentError
if
value isn't a boolean. Returns the value of the value that was
validated.
Ensures that value is a function. Throws an IllegalArgumentError
if
value isn't a function. Returns the value of the value that was
validated.
Ensures that value is an object. Throws an IllegalArgumentError
if
value isn't an object. Returns the value of the value that was
validated.
Extends Error
and is thrown to signal illegal arguments.
Extends Error
and is thrown to signal that the program or object has reached
an illegal state.
This code is free to use under the terms of the MIT license.
FAQs
Precondition checking utilities.
The npm package precond receives a total of 0 weekly downloads. As such, precond popularity was classified as not popular.
We found that precond 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.