1.0.0 • Published 5 years ago
fake-history-fns v1.0.0
fake-history-fns
fake-history functions.
Installation
$ npm install fake-history-fns
Usage
import assert from 'assert';
import {
back,
create,
current,
currentState,
length,
next,
nextState,
previous,
previousState,
pushState,
state
} from 'fake-history-fns';
const p0 = create();
const p1 = pushState(p0, 1, '1', '/1');
const p2 = pushState(p1, 2, '2', '/2');
const p3 = pushState(p2, 3, '3', '/3');
const b1 = back(p0);
assert(length(b1) === 3);
assert(state(b1) === 2);
assert(current(b1) === '/2');
assert(currentState(b1) === 2);
assert(next(b1) === '/3');
assert(nextState(b1) === 3);
assert(previous(b1) === '/1');
assert(previousState(b1) === 1);
Related Project
- bouzuya/fake-history ... A fake History object.
Development
$ yarn
$ npm run watch