1.0.0 • Published 1 year ago
@288-toolkit/functions v1.0.0
Functions
npm i @288-toolkit/functions
A collection of functions to wrap other functions with.
once()
Create a function that can only be invoked once.
A re-export of https://github.com/angus-c/just/tree/master/packages/function-once.
expirable()
Creates an expirable version of a value.
The ttl
is the time to live, in seconds, for the data.
Returns a function that returns the value if it is not expired.
const expirable: <T>(value: T, ttl: number) => T;
runCallbacks()
Batch multiple functions into one.
const unsubscribeAll = runCallbacks(
store.subscribe(),
anotherStore.subscribe(),
wowAnotherStore.subsribe()
);
unsubscribeAll();
1.0.0
1 year ago