parse-link-header

WebJar for parse-link-header

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

parse-link-header
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

parse-link-header
WebJar for parse-link-header
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/thlorenz/parse-link-header

Download parse-link-header

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/parse-link-header/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>parse-link-header</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/parse-link-header/
implementation 'org.webjars.npm:parse-link-header:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/parse-link-header/
implementation ("org.webjars.npm:parse-link-header:1.0.1")
'org.webjars.npm:parse-link-header:jar:1.0.1'
<dependency org="org.webjars.npm" name="parse-link-header" rev="1.0.1">
  <artifact name="parse-link-header" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='parse-link-header', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "parse-link-header" % "1.0.1"
[org.webjars.npm/parse-link-header "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : xtend jar [4.0.1,4.1)

Project Modules

There are no modules declared in this project.

parse-link-header build status

testling badge

Parses a link header and returns paging information for each contained link.

var parse = require('parse-link-header');

var linkHeader =
  '<https://api.github.com/user/9287/repos?page=3&per_page=100>; rel="next", ' +
  '<https://api.github.com/user/9287/repos?page=1&per_page=100>; rel="prev"; pet="cat", ' +
  '<https://api.github.com/user/9287/repos?page=5&per_page=100>; rel="last"'

var parsed = parse(linkHeader);
console.log(parsed);
{ next:
   { page: '3',
     per_page: '100',
     rel: 'next',
     url: 'https://api.github.com/user/9287/repos?page=3&per_page=100' },
  prev:
   { page: '1',
     per_page: '100',
     rel: 'prev',
     pet: 'cat',
     url: 'https://api.github.com/user/9287/repos?page=1&per_page=100' },
  last:
   { page: '5',
     per_page: '100',
     rel: 'last',
     url: 'https://api.github.com/user/9287/repos?page=5&per_page=100' } }

Installation

npm install parse-link-header

API

parseLinkHeader(linkHeader : String) : Object

Parses the given link header containing web links and returns an object keyed by the rel property that contains information about each link.

Formatting a link header

The 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 module.

Versions

Version
1.0.1