{"name":"parse-link-header","version":"0.2.0","description":"Parses a link header and returns paging information for each contained link.","main":"index.js","scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/thlorenz/parse-link-header.git"},"homepage":"https://github.com/thlorenz/parse-link-header","dependencies":{"xtend":"~4.0.0"},"devDependencies":{"tape":"~1.0.3","tap":"~0.4.3"},"keywords":["parse","link","header","weblink","web","link","rel"],"author":{"name":"Thorsten Lorenz","email":"thlorenz@gmx.de","url":"http://thlorenz.com"},"license":"MIT","engine":{"node":">=0.6"},"testling":{"files":"test/*.js","browsers":["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},"gitHead":"3259c2ef72116f7b1cbb23a1b86b31c95192c120","bugs":{"url":"https://github.com/thlorenz/parse-link-header/issues"},"_id":"parse-link-header@0.2.0","_shasum":"31516097825432afb88039fddc6b9e3b734a70c5","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"thlorenz","email":"thlorenz@gmx.de"},"maintainers":[{"name":"thlorenz","email":"thlorenz@gmx.de"}],"dist":{"shasum":"31516097825432afb88039fddc6b9e3b734a70c5","tarball":"http://registry-npm.ywwl.com/parse-link-header/download/parse-link-header-0.2.0.tgz","integrity":"sha512-Awu0Z08S3GMDN5U4yOhqyQvVmWbq00xV7w3s3iG67h0g1Zi+OXDqXDN8Mk3gvyywp7hNuKxDw4NFkPjJpy1EYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtRnFC1tyt/PNpHpZD52nbkXahYstJqfF8gz2ZwBzxGQIhAInrssiTyRlREjYEON6n9QHeBUbYaVg7qbKQNlg9zAvA"}],"size":2851,"noattachment":false,"key":"/parse-link-header/-/parse-link-header-0.2.0.tgz"},"directories":{},"readme":"# parse-link-header [![build status](https://secure.travis-ci.org/thlorenz/parse-link-header.png)](http://travis-ci.org/thlorenz/parse-link-header)\n\n[![testling badge](https://ci.testling.com/thlorenz/parse-link-header.png)](https://ci.testling.com/thlorenz/parse-link-header)\n\nParses a link header and returns paging information for each contained link.\n\n```js\nvar parse = require('parse-link-header');\n\nvar linkHeader =\n  '<https://api.github.com/user/9287/repos?page=3&per_page=100>; rel=\"next\", ' +\n  '<https://api.github.com/user/9287/repos?page=1&per_page=100>; rel=\"prev\"; pet=\"cat\", ' +\n  '<https://api.github.com/user/9287/repos?page=5&per_page=100>; rel=\"last\"'\n\nvar parsed = parse(linkHeader);\nconsole.log(parsed);\n```\n\n```js\n{ next:\n   { page: '3',\n     per_page: '100',\n     rel: 'next',\n     url: 'https://api.github.com/user/9287/repos?page=3&per_page=100' },\n  prev:\n   { page: '1',\n     per_page: '100',\n     rel: 'prev',\n     pet: 'cat',\n     url: 'https://api.github.com/user/9287/repos?page=1&per_page=100' },\n  last:\n   { page: '5',\n     per_page: '100',\n     rel: 'last',\n     url: 'https://api.github.com/user/9287/repos?page=5&per_page=100' } }\n```\n\n## Installation\n\n    npm install parse-link-header\n\n## API\n\n***parseLinkHeader(linkHeader : String) : Object***\n\nParses the given link header containing [web links](http://tools.ietf.org/html/rfc5988) and returns an object keyed by\nthe `rel` property that contains information about each link.\n\n### Environmental Variables\n\nTo avoid redundantly parsing of extremely long (invalid) input, the package uses 2 env variabes:\n\n`PARSE_LINK_HEADER_MAXLEN` - Sets the number of characters the input should be limited to - longer inputs will not be handled. Defaults to `2000`.\n\n`PARSE_LINK_HEADER_THROW_ON_MAXLEN_EXCEEDED` - Defines behavior for when the `PARSE_LINK_HEADER_MAXLEN` parameter is exceeded. if defined, an error will be thrown; if it's `null`, the function fails silently by returning `null`. Defaults to `null`.\n\n### Formatting a link header\n\nThe purpose of this module is to parse the link header information. To format an object generated by this module back to the link header string, use the [format-link-header](https://github.com/jonathansamines/format-link-header) module.\n","publish_time":1412535007177,"_cnpm_publish_time":1412535007177,"dist-tags":{"latest":"2.0.0"}}