fake-history-fns
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Development

$ yarn
$ npm run watch

Badges

Travis CI

License

MIT

Author

bouzuya <m@bouzuya.net> (http://bouzuya.net)

Readme

Keywords

none

Package Sidebar

Install

npm i fake-history-fns

Weekly Downloads

12

Version

1.0.0

License

MIT

Unpacked Size

14.4 kB

Total Files

41

Last publish

Collaborators

  • bouzuya