Comparing version 0.0.2 to 0.1.0
{ | ||
"name": "weblinks", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Paginate REST endpoints", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
# Weblinks for javascript | ||
This project creates pagination links for REST endpoints. | ||
This project creates pagination links for REST endpoints in accordance with [RFC5988](https://tools.ietf.org/html/rfc5988). | ||
@@ -13,3 +13,3 @@ ## Install | ||
### create | ||
### Create | ||
@@ -92,4 +92,90 @@ ```javascript | ||
toString: [Function] }, | ||
linkHeader: '<http://website.com/?page=2&page_size=10>; rel="self",\n<http://website.com/?page=1&page_size=10>; rel="first",\n<http://website.com/?page=10&page_size=10>; rel="last",\n<http://website.com/?page=3&page_size=10>; rel="next",\n<http://website.com/?page=1&page_size=10>; rel="prev"' } | ||
linkHeader: `<http://website.com/?page=2&page_size=10>; rel="self", | ||
<http://website.com/?page=1&page_size=10>; rel="first", | ||
<http://website.com/?page=10&page_size=10>; rel="last", | ||
<http://website.com/?page=3&page_size=10>; rel="next", | ||
<http://website.com/?page=1&page_size=10>; rel="prev"` } | ||
``` | ||
### Parse Header | ||
```javascript | ||
const weblinks = require("weblinks"); | ||
const header = `<http://website.com/?page=2&page_size=10>; rel="self", | ||
<http://website.com/?page=1&page_size=10>; rel="first", | ||
<http://website.com/?page=10&page_size=10>; rel="last", | ||
<http://website.com/?page=3&page_size=10>; rel="next", | ||
<http://website.com/?page=1&page_size=10>; rel="prev"`; | ||
{ url: 'http://website.com', | ||
self: | ||
Url { | ||
protocol: 'http:', | ||
slashes: true, | ||
auth: null, | ||
host: 'website.com', | ||
port: null, | ||
hostname: 'website.com', | ||
hash: null, | ||
query: { page: 2, page_size: 10 }, | ||
pathname: '/', | ||
path: '/', | ||
href: 'http://website.com/', | ||
toString: [Function] }, | ||
first: | ||
Url { | ||
protocol: 'http:', | ||
slashes: true, | ||
auth: null, | ||
host: 'website.com', | ||
port: null, | ||
hostname: 'website.com', | ||
hash: null, | ||
query: { page: 1, page_size: 10 }, | ||
pathname: '/', | ||
path: '/', | ||
href: 'http://website.com/', | ||
toString: [Function] }, | ||
last: | ||
Url { | ||
protocol: 'http:', | ||
slashes: true, | ||
auth: null, | ||
host: 'website.com', | ||
port: null, | ||
hostname: 'website.com', | ||
hash: null, | ||
query: { page: 10, page_size: 10 }, | ||
pathname: '/', | ||
path: '/', | ||
href: 'http://website.com/', | ||
toString: [Function] }, | ||
prev: | ||
Url { | ||
protocol: 'http:', | ||
slashes: true, | ||
auth: null, | ||
host: 'website.com', | ||
port: null, | ||
hostname: 'website.com', | ||
hash: null, | ||
query: { page: 1, page_size: 10 }, | ||
pathname: '/', | ||
path: '/', | ||
href: 'http://website.com/', | ||
toString: [Function] }, | ||
next: | ||
Url { | ||
protocol: 'http:', | ||
slashes: true, | ||
auth: null, | ||
host: 'website.com', | ||
port: null, | ||
hostname: 'website.com', | ||
hash: null, | ||
query: { page: 3, page_size: 10 }, | ||
pathname: '/', | ||
path: '/', | ||
href: 'http://website.com/', | ||
toString: [Function] } } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30639
180