Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Content-Range header formatter.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
README.md Consistent naming
bower.json v1.0.0
index.js
package.json
test.js Consistent naming

README.md

content-range

Build Status Dependency Status devDependency Status

Content-range header formatter.

Install

npm install content-range

Usage

var contentRange = require('content-range');

var header = contentRange.format({
  unit: 'items',
  first: 10,
  limit: 20,
  length: 100
});

console.log(header); // items 10-29/100

contentRange.format(obj)

Format a content-range header.

var header = contentRange.format({
  unit: 'items',
  first: 10,
  limit: 20,
  length: 100
});

console.log(header); // items 10-29/100

contentRange.parse(str)

Parse a content-range header.

var parts = contentRange.parse('items 10-29/100');

console.log(parts); // { unit: 'items', first: 10, last: 29, length: 100 }

License

MIT

Something went wrong with that request. Please try again.