Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
A collection of common runtime predicates that TypeScript actually understands.
A collection of common runtime predicates that TypeScript actually understands.
npm install aint
import { isNotNull } from 'aint';
// given an array containing null and number values
const array = [1, 2, null]; // ts infers Array<null | number>
// ...remove null values by using isNotNull
const arrayWithoutNull = array.filter(isNotNull); // ts infers Array<number>
It's easy to perform a check using lodash or vanilla JavaScript, e.g.
const array = [1, 2, null].filter(Boolean);
The example above will filter out the null
value as expected (because null
is considered to be faulty).
However, TypeScript will NOT infer the correct type [playground link]. It will understand the type of array as being Array<null | number>
instead of Array<number>
.
aint
provides a simple API to test for predicates, while making TypeScript understand.
Source code contributions are most welcome, as long as the linter is satisfied.
Causaly is building the world's largest biomedical knowledge platform, using technologies such as TypeScript, React and Node.js. Find out more about our openings at https://apply.workable.com/causaly/.
MIT
FAQs
A collection of common runtime predicates that TypeScript actually understands.
We found that aint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.