GitXplorerGitXplorer
l

github-pagination

public
14 stars
4 forks
1 issues

Commits

List of commits on branch master.
Unverified
b4015e102e44f8fda8b181ec00ff1ef1405b5f91

Merge pull request #3 from ilyalesik/master

llisposter committed 8 years ago
Unverified
2d1eca0ebdf438329af461766ea2bb5e08a4ac7c

fix per_page case

iilyalesik committed 8 years ago
Unverified
81514a4cf3fdacb9f379a020ffb459d9c1e806e2

Merge pull request #1 from SherylHohman/patch-1

llisposter committed 9 years ago
Unverified
b103cde3875def93e86b38d8d4ed94ba71f5f6a3

fix typo

SSherylHohman committed 9 years ago
Unverified
7930c5cf3b53d39b72f55d9b4b31cc682ff05001

init

llisposter committed 10 years ago

README

The README file for this repository.

github-pagination

NPM version

A simple js lib for parse GitHub's pagination info from API's response.


Installation

$ npm install github-pagination --save

or

$ bower install github-pagination --save

Example

in node.js / io.js

var octopage = require('./');

var test = '<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=15>; rel="next",  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last",  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=1>; rel="first",  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=13>; rel="prev"';

console.log(octopage.parser(test));
// { next: '15', last: '34', first: '1', prev: '13' }

in browser

link this script and then,

<script src="octopage.js"></script>
<script>
  var test = '<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=15>; rel="next",  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last",  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=1>; rel="first",  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=13>; rel="prev"';

  console.log(octopage.parser(test));
  // { next: '15', last: '34', first: '1', prev: '13' }
</script>

License

MIT © Leigh Zhu