mirror of https://gitee.com/bigwinds/arangodb
* Make jsunity hash function avoid recursion This guards against traversals of recursive data structures causing a stack overflow. This is crucial when using assertEqual with unknown inputs. * Update deps accepts: 1.3.4 -> 1.3.5 ansi_up: 2.0.2 -> 4.0.3 content-disposition: 0.5.2 -> 0.5.3 dedent: 0.6.0 -> 0.7.0 error-stack-parser: 1.3.6 -> 2.0.2 eslint: 2.13.1 -> 5.16.0 eslint-config-semistandard: 6.0.2 -> removed eslint-config-standard: 5.3.1 -> removed eslint-plugin-promise: 1.3.2 -> removed eslint-plugin-standard: 1.3.2 -> removed highlight.js: 9.12.0 -> 9.15.6 http-errors: 1.6.2 -> 1.7.2 iconv-lite: 0.4.19 -> 0.4.24 joi: 9.2.0 -> 14.3.1 joi-to-json-schema: 2.3.0 -> 4.0.1 js-yaml: 3.10.0 -> 3.13.1 marked: 0.3.9 -> 0.6.2 mime-types: 2.1.12 -> 2.1.22 mocha: 2.5.3 -> 6.1.3 qs: 6.5.1 -> 6.7.0 semver: 5.4.1 -> 6.0.0 statuses: 1.4.0 -> 1.5.0 timezone: 1.0.13 -> 1.0.22 type-is: 1.6.15 -> 1.6.16 underscore: 1.8.3 -> 1.9.1 * Inline eslint semistandard config The eslint standard config has become extremely opinionated and incompatible with the existing coding style. This subset matches the existing coding style most closely. In the future we should migrate to an autoformatter like prettier and avoid this problem altogether. * Linting * Fix mocha runner * New joi has additional property |
||
---|---|---|
.. | ||
HISTORY.md | ||
LICENSE | ||
README.md | ||
index.js | ||
package.json |
README.md
range-parser
Range header field parser.
Installation
$ npm install range-parser
API
var parseRange = require('range-parser')
parseRange(size, header, options)
Parse the given header
string where size
is the maximum size of the resource.
An array of ranges will be returned or negative numbers indicating an error parsing.
-2
signals a malformed header string-1
signals an unsatisfiable range
// parse header from request
var range = parseRange(size, req.headers.range)
// the type of the range
if (range.type === 'bytes') {
// the ranges
range.forEach(function (r) {
// do something with r.start and r.end
})
}
Options
These properties are accepted in the options object.
combine
Specifies if overlapping & adjacent ranges should be combined, defaults to false
.
When true
, ranges will be combined and returned as if they were specified that
way in the header.
parseRange(100, 'bytes=50-55,0-10,5-10,56-60', { combine: true })
// => [
// { start: 0, end: 10 },
// { start: 50, end: 60 }
// ]