
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
stateful-value
Advanced tools
Please see ARTICLE.md for the rationale of the package.
npm i -S stateful-value
To represent a value that could be:
import { StatefulValue } from "stateful-value";
let data: StatefulValue<string>;
if (isValid(data)) {
// data is guaranteed to be a string
console.log(data.length);
}
data = await loadData();
if (isError(data)) {
// data is guaranteed to be an Error (or subclass of Error) object
console.error(data.message);
}
StatefulValue<T>Defines a type that can represent a value that is either unfulfilled, or is an error, or is valid.
isUnfulfilled(): booleanDetermines whether the value is undefined or an Unfulfilled object.
isError(): booleanDetermines whether the value is an Error object.
isValid(): booleanDetermines whether the value is valid (i.e. an instance of type T).
isNonNull(): booleanDetermines whether the value is valid and is not null.
Note: null is considered a valid value if T contains it, e.g. StatefulValue<string | null>.
getValue(): T | undefinedReturns the value if it is valid; otherwise, returns undefined.
getError(): T | undefinedReturns the value if it is an Error object; otherwise, returns undefined.
resolveValueasync function resolveValue<T>(
callback: () => Promise<T>,
dependencies: StatefulValue<unknown>[] = []
): Promise<StatefulValue<T>>
Resolves a stateful value when all dependencies are valid.
Unfulfilled.FAQs
Values with built-in states. Suitable for async operations.
The npm package stateful-value receives a total of 1 weekly downloads. As such, stateful-value popularity was classified as not popular.
We found that stateful-value 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.