
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.
@technically/is-not-undefined
Advanced tools
A micro-package to check if a value is not `undefined`. With proper TS typing!
@technically/is-not-undefined is a micro-package to check if a value is not null. With proper TS typing!
import { isNotUndefined } from '@technically/is-not-undefined';
const values = ['hello', 'world', undefined];
const uppercase = values.filter(isNotUndefined).map((value) => {
return value.toUpperCase(); // OK
});
In Typescript, it is often needed to filter out undefined from a list of values, and then process them.
The problem is that Boolean does not currently work as a type-guard in Typescript:
const values = ['hello', 'world', undefined];
const uppercase = values.filter(Boolean).map((value) => {
return value.toUpperCase(); // TS18048: 'value' is possibly 'undefined'.
});
To mitigate the issue you have to wrap Boolean into a type-guard function like this:
const values = ['hello', 'world', undefined];
const uppercase = values.filter((x): x is Exclude<typeof x, undefined> => Boolean(x)).map((value) => {
return value.toUpperCase(); // OK
});
To avoid writing these ad-hoc type-guards every time, I've created this package.
Authored by Ivan Voskoboinyk.
FAQs
A micro-package to check if a value is not `undefined`. With proper TS typing!
The npm package @technically/is-not-undefined receives a total of 434 weekly downloads. As such, @technically/is-not-undefined popularity was classified as not popular.
We found that @technically/is-not-undefined 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.