burl
Compute hal-json:_links
previous
and next
values. Useful when urls need
to be processed before being ready to use.
Installation
npm install burl
Usage
var burl = ; var links = ; links; links;// => {// previous: 'http://mysite.com/api?until=12345677',// next: 'http://mysite.com/api?from=12345677'// }
API
var links = burl()
Create a new burl
instance. Takes a single option with optional
previous
, next
and normalize
functions. The functions must return their
containing value.
var burl = ; var links = ;
.set()
Save links to burl. Gets passed through the normalize
function before
performing a comparison to keep the lowest value for previous
and the heighest
value for next
. Uses linkstash
under the hood.
links;
.get()
Get the composed urls for previous
and next
back in an object.
links;// => {// previous: 'http://mysite.com/api?until=12345677',// next: 'http://mysite.com/api?from=12345677'// }