0.0.121 • Published 1 year ago
ts-util-station v0.0.121
ts-util-station 🚀
Docs
compose
params:
- (...funcs: Function[])
returns Function
example
import { compose } from "ts-util-station";
compose((x) => x + 1,(x) => x * 2,(x) => x / 3)(1);
curry
params:
- (func: Function, arity?: number)
returns Function
example
import { curry } from "ts-util-station";
const add = (a, b) => a + b;
const addCurried = curry(add);
addCurried(1)(2);
addCurried(1, 2);
addCurried(1, 2, 3);
debounce
params:
- (func: Function, delay: number)
returns Function
example
import { debounce } from "ts-util-station";
debounce(updateLayout, 250);
memoize
params:
- (func: Function)
returns Function
example
import { memoize } from "ts-util-station";
function fibonacci(n) {
if (n < 2) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}
memoize(fibonacci);
omit
params:
- (obj: object, keys: string[])
returns object
example
import { omit } from "ts-util-station";
omit({ a: 1, b: 2, c: 3 }, ["a", "c"]); // { b: 2 }
once
params:
- (func: Function)
returns Function
example
import { once } from "ts-util-station";
once(updateLayout);
partial
params:
- (func: Function, ...args: any[])
returns Function
example
import { partial } from "ts-util-station";
const add = (a, b) => a + b;
const addPartial = partial(add, 1);
addPartial(2);
addPartial(2, 3);
addPartial(2, 3, 4);
pick
params:
- (obj: object, keys: string[])
returns object
example
import { pick } from "ts-util-station";
pick({ a: 1, b: 2, c: 3 }, ["a", "c"]); // { a: 1, c: 3 }
pipe
params:
- (...funcs: Function[])
returns Function
example
import { pipe } from "ts-util-station";
pipe((x) => x + 1,(x) => x * 2,(x) => x / 3)(1);
throttle
params:
- (func: Function, delay: number)
returns Function
example
import { throttle } from "ts-util-station";
throttle(updateLayout, 250);
zip
params:
example
import { zip } from "ts-util-station";
zip([1, 2, 3], [4, 5, 6], [7, 8, 9]);
Change log
v0.0.1
- add method 'compose'
- add method 'curry'
- add method 'debounce'
- add method 'memoize'