segmentize
v0.4.1
Published
Simple segmentation useful for pagination
Downloads
10,710
Readme
segmentize - Simple segmentation useful for pagination
expect(segmentize({
page: 4,
pages: 10,
beginPages: 2, // optional
endPages: 1, // optional
sidePages: 1 // defaults to zero
})).to.deep.equal({
beginPages: [1, 2], // one-indexed
previousPages: [3],
centerPage: [4], // always one page
nextPages: [5],
endPages: [10]
});
See ./test.js
for more examples.
Contributors
- Artem Sapegin -
const
->var
. Safari needs this to work.
License
segmentize is available under MIT. See LICENSE for more details.