Random TypeScript utilities.
Run:
npm i @francescozoccheddu/ts-goodies
Use it like any other library:
import { Num, Nul, RArr } from '@francescozoccheddu/ts-goodies/types';
import { nonNul } from '@francescozoccheddu/ts-goodies/arrays';
const numOrNul: RArr<Num | Nul> = [1, 2, null, 4];
const num: RArr<Num> = nonNul(numOrNul);
console.log(num);
Import @francescozoccheddu/ts-goodies/globals/essentials
first:
import '@francescozoccheddu/ts-goodies/globals/essentials';
import { nonNul } from '@francescozoccheddu/ts-goodies/arrays';
const numOrNul: RArr<Num | Nul> = [1, 2, null, 4];
const num: RArr<Num> = nonNul(numOrNul);
console.log(num);
Import @francescozoccheddu/ts-goodies/globals/augmentations
first:
import '@francescozoccheddu/ts-goodies/globals/augmentations';
const numOrNul: RArr<Num | Nul> = [1, 2, null, 4];
const num: RArr<Num> = numOrNul.nonNul;
console.log(num);
Run:
npm start