curve-store
Examples
Simple Usage
import { createStore } from 'curve-store';
import { linear, derivative } from 'curve-store/samplers';
const store = createStore({
x: linear('x'),
dx: derivative('x')
});
store.set(0, { x: 0 });
store.set(1, { x: 1 });
store.sample(0.25);
Custom sampling
import { createStore } from 'create-store';
import { getPointBefore, getPointAfter } from 'create-store/utils';
const store = createStore({
myKey: (t, state) => {
const before = getPointBefore(state.myKey, t);
const after = getPointAfter(state.myKey, t);
return customVal;
}
});
store.set(0, { myKey: 0 });
store.set(1, { myKey: 1 });
store.sample(0.25);
Installation
$ npm install --save curve-store
LICENSE
MIT