segmentize
Simple segmentation useful for pagination
Last updated 5 years ago by bebraw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install segmentize 
SYNC missed versions from official npm registry.

build status

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

License

segmentize is available under MIT. See LICENSE for more details.

Current Tags

  • 0.4.1                                ...           latest (5 years ago)

8 Versions

  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 68
Last Day 0
Last Week 47
Last Month 132
Dependencies (0)
None
Dev Dependencies (7)

Copyright 2014 - 2017 © taobao.org |