Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
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
0.6.2
FAQs
A collection of common runtime predicates that TypeScript actually understands.
The npm package aint receives a total of 259 weekly downloads. As such, aint popularity was classified as not popular.
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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.