parse-links

Parse the Links header format and return a javascript object.

npm install parse-links
75 downloads in the last day
268 downloads in the last week
747 downloads in the last month

Parse a Links header into a javascript object.

Install

npm install parse-links

Usage

var parseLinks = require('parse-links');
var someLinksHeader = '</api/users?page=0&per_page=2>; rel="first", ' +
                      '</api/users?page=1&per_page=2>; rel="next", ' +
                      '</api/users?page=3&per_page=2>; rel="last"';

console.log(parseLinks(someLinksHeader));

// This will print:
// { 
//   first: '/api/users?page=0&per_page=2',
//   next: '/api/users?page=1&per_page=2',
//   last: '/api/users?page=3&per_page=2' 
// }

License

MIT!

npm loves you