# li

> Parse the Links header format and return a javascript object.

Latest version **1.3.0** (published 2018-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install li
pnpm add li
yarn add li
bun add li
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2018-01-09 |
| First published | 2014-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | José F. Romaniello |
| Maintainers | jfromaniello |
| Keywords | links, http |

## Links

- npm: https://www.npmjs.com/package/li
- Repository: https://github.com/jfromaniello/li
- Homepage: https://github.com/jfromaniello/li#readme
- Issues: https://github.com/jfromaniello/li/issues
- npm.io page: https://npm.io/package/li

## Recent versions

- 1.3.0 (latest) — 2018-01-09
- 1.2.1 — 2017-01-09
- 1.1.0 — 2016-10-31
- 1.0.1 — 2015-03-02
- 1.0.0 — 2014-02-22

## README

[![Build Status](https://travis-ci.org/jfromaniello/li.svg?branch=master)](https://travis-ci.org/jfromaniello/li)

Parse and format [Link header according to RFC 5988](http://www.w3.org/Protocols/9707-link-header.html).

## Install

    $ npm install li

Also works with bower, component.js, browserify, amd, etc.

## Usage

Parse a Link header:

~~~javascript
var li = require('li');
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(li.parse(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'
// }
~~~

Generate a Link header as follow with stringify:

~~~javascript
var linksObject = {
  first : '/api/users?page=0&per_page=2',
  next  : '/api/users?page=1&per_page=2',
  last  : '/api/users?page=3&per_page=2',
};

console.log(li.stringify(linksObject);

// This will print the string:
// </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"
~~~

### Testing

    $ npm test

## License

MIT 2014 - JOSE F. ROMANIELLO

---
_Source: https://npm.io/package/li · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
