1.0.81 • Published 3 years ago

typelevel v1.0.81

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

type level programming

npm install typelevel@latest

Examples

import type {
    Split, Join, Concat,
    Add, Sub, Mul, Div, Pow, Modulo, Sqrt,
    Filter, Repeat, optional
} from 'typelevel';

type split = Split<"hello world">; // ["h", "e", "l", "l", "o", " ", "w", "o", "r", "l", "d"]

type add = Add<1, 2>; // 3
type sub = Sub<3, 2>; // 1
type mul = Mul<3, 2>; // 6
type div = Div<6, 2>; // 3
type pow = Pow<3, 5>; // 243
type modulo = Modulo<5, 3>; // 2
type sqrt = Sqrt<81>; // 9

interface Abcd { a: number, b: string, c: Array<boolean>, d: number, e: string };
type filter = Filter<Abcd, number | Array<boolean>>; 
// { d: number, a: number, c: Array<boolean> }

type repeat = Repeat<3, "a">; // ["a", "a", "a"]

type optional = Optional<{ a: string; b: number; c: boolean }, 'a' | 'c'>;
 // { b: number; a?: string | undefined; c?: boolean | undefined; }

type join1 = Join<["a", "b", "c"]>; // a b c
type join2 = Join<["a", "b", "c"], ", ">; // a, b, c
type concat = Concat<["a", "b", "c"]>; // abc
1.0.8

3 years ago

1.0.7

3 years ago

1.0.62

3 years ago

1.0.61

3 years ago

1.0.71

3 years ago

1.0.81

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago