Changements dans les modules (nouvelle version Express, mysql, ..)
This commit is contained in:
20
node_modules/range-parser/HISTORY.md
generated
vendored
20
node_modules/range-parser/HISTORY.md
generated
vendored
@@ -1,21 +1,5 @@
|
||||
1.2.1 / 2019-05-10
|
||||
==================
|
||||
|
||||
* Improve error when `str` is not a string
|
||||
|
||||
1.2.0 / 2016-06-01
|
||||
==================
|
||||
|
||||
* Add `combine` option to combine overlapping ranges
|
||||
|
||||
1.1.0 / 2016-05-13
|
||||
==================
|
||||
|
||||
* Fix incorrectly returning -1 when there is at least one valid range
|
||||
* perf: remove internal function
|
||||
|
||||
1.0.3 / 2015-10-29
|
||||
==================
|
||||
unreleased
|
||||
==========
|
||||
|
||||
* perf: enable strict mode
|
||||
|
||||
|
||||
3
node_modules/range-parser/LICENSE
generated
vendored
3
node_modules/range-parser/LICENSE
generated
vendored
@@ -1,7 +1,6 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com
|
||||
Copyright (c) 2012-2014 TJ Holowaychuk <vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
57
node_modules/range-parser/README.md
generated
vendored
57
node_modules/range-parser/README.md
generated
vendored
@@ -1,8 +1,8 @@
|
||||
# range-parser
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
@@ -10,35 +10,27 @@ Range header field parser.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
```
|
||||
$ npm install range-parser
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var parseRange = require('range-parser')
|
||||
```
|
||||
|
||||
### parseRange(size, header, options)
|
||||
### parseRange(size, header)
|
||||
|
||||
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
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
* `-1` signals an invalid range
|
||||
|
||||
```js
|
||||
// parse header from request
|
||||
var range = parseRange(size, req.headers.range)
|
||||
var range = parseRange(req.headers.range)
|
||||
|
||||
// the type of the range
|
||||
if (range.type === 'bytes') {
|
||||
@@ -49,36 +41,17 @@ if (range.type === 'bytes') {
|
||||
}
|
||||
```
|
||||
|
||||
#### 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.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
parseRange(100, 'bytes=50-55,0-10,5-10,56-60', { combine: true })
|
||||
// => [
|
||||
// { start: 0, end: 10 },
|
||||
// { start: 50, end: 60 }
|
||||
// ]
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/range-parser/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/range-parser?branch=master
|
||||
[node-image]: https://badgen.net/npm/node/range-parser
|
||||
[node-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/range-parser
|
||||
[npm-image]: https://img.shields.io/npm/v/range-parser.svg
|
||||
[npm-url]: https://npmjs.org/package/range-parser
|
||||
[npm-version-image]: https://badgen.net/npm/v/range-parser
|
||||
[travis-image]: https://badgen.net/travis/jshttp/range-parser/master
|
||||
[node-version-image]: https://img.shields.io/node/v/range-parser.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/range-parser.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/range-parser
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/range-parser.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/range-parser
|
||||
[downloads-image]: https://img.shields.io/npm/dm/range-parser.svg
|
||||
[downloads-url]: https://npmjs.org/package/range-parser
|
||||
|
||||
147
node_modules/range-parser/index.js
generated
vendored
147
node_modules/range-parser/index.js
generated
vendored
@@ -1,162 +1,63 @@
|
||||
/*!
|
||||
* range-parser
|
||||
* Copyright(c) 2012-2014 TJ Holowaychuk
|
||||
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = rangeParser
|
||||
module.exports = rangeParser;
|
||||
|
||||
/**
|
||||
* Parse "Range" header `str` relative to the given file `size`.
|
||||
*
|
||||
* @param {Number} size
|
||||
* @param {String} str
|
||||
* @param {Object} [options]
|
||||
* @return {Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function rangeParser (size, str, options) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('argument str must be a string')
|
||||
}
|
||||
function rangeParser(size, str) {
|
||||
var valid = true;
|
||||
var i = str.indexOf('=');
|
||||
|
||||
var index = str.indexOf('=')
|
||||
if (-1 == i) return -2;
|
||||
|
||||
if (index === -1) {
|
||||
return -2
|
||||
}
|
||||
|
||||
// split the range string
|
||||
var arr = str.slice(index + 1).split(',')
|
||||
var ranges = []
|
||||
|
||||
// add ranges type
|
||||
ranges.type = str.slice(0, index)
|
||||
|
||||
// parse all ranges
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var range = arr[i].split('-')
|
||||
var start = parseInt(range[0], 10)
|
||||
var end = parseInt(range[1], 10)
|
||||
var arr = str.slice(i + 1).split(',').map(function(range){
|
||||
var range = range.split('-')
|
||||
, start = parseInt(range[0], 10)
|
||||
, end = parseInt(range[1], 10);
|
||||
|
||||
// -nnn
|
||||
if (isNaN(start)) {
|
||||
start = size - end
|
||||
end = size - 1
|
||||
start = size - end;
|
||||
end = size - 1;
|
||||
// nnn-
|
||||
} else if (isNaN(end)) {
|
||||
end = size - 1
|
||||
end = size - 1;
|
||||
}
|
||||
|
||||
// limit last-byte-pos to current length
|
||||
if (end > size - 1) {
|
||||
end = size - 1
|
||||
}
|
||||
if (end > size - 1) end = size - 1;
|
||||
|
||||
// invalid or unsatisifiable
|
||||
if (isNaN(start) || isNaN(end) || start > end || start < 0) {
|
||||
continue
|
||||
}
|
||||
// invalid
|
||||
if (isNaN(start)
|
||||
|| isNaN(end)
|
||||
|| start > end
|
||||
|| start < 0) valid = false;
|
||||
|
||||
// add range
|
||||
ranges.push({
|
||||
return {
|
||||
start: start,
|
||||
end: end
|
||||
})
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (ranges.length < 1) {
|
||||
// unsatisifiable
|
||||
return -1
|
||||
}
|
||||
arr.type = str.slice(0, i);
|
||||
|
||||
return options && options.combine
|
||||
? combineRanges(ranges)
|
||||
: ranges
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine overlapping & adjacent ranges.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function combineRanges (ranges) {
|
||||
var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)
|
||||
|
||||
for (var j = 0, i = 1; i < ordered.length; i++) {
|
||||
var range = ordered[i]
|
||||
var current = ordered[j]
|
||||
|
||||
if (range.start > current.end + 1) {
|
||||
// next range
|
||||
ordered[++j] = range
|
||||
} else if (range.end > current.end) {
|
||||
// extend range
|
||||
current.end = range.end
|
||||
current.index = Math.min(current.index, range.index)
|
||||
}
|
||||
}
|
||||
|
||||
// trim ordered array
|
||||
ordered.length = j + 1
|
||||
|
||||
// generate combined range
|
||||
var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)
|
||||
|
||||
// copy ranges type
|
||||
combined.type = ranges.type
|
||||
|
||||
return combined
|
||||
}
|
||||
|
||||
/**
|
||||
* Map function to add index value to ranges.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function mapWithIndex (range, index) {
|
||||
return {
|
||||
start: range.start,
|
||||
end: range.end,
|
||||
index: index
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map function to remove index value from ranges.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function mapWithoutIndex (range) {
|
||||
return {
|
||||
start: range.start,
|
||||
end: range.end
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort function to sort ranges by index.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function sortByRangeIndex (a, b) {
|
||||
return a.index - b.index
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort function to sort ranges by start position.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function sortByRangeStart (a, b) {
|
||||
return a.start - b.start
|
||||
return valid ? arr : -1;
|
||||
}
|
||||
|
||||
24
node_modules/range-parser/package.json
generated
vendored
24
node_modules/range-parser/package.json
generated
vendored
@@ -2,12 +2,7 @@
|
||||
"name": "range-parser",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
|
||||
"description": "Range header field string parser",
|
||||
"version": "1.2.1",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"James Wyatt Cready <wyatt.cready@lanetix.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"version": "1.0.3",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"range",
|
||||
@@ -16,16 +11,8 @@
|
||||
],
|
||||
"repository": "jshttp/range-parser",
|
||||
"devDependencies": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint": "5.16.0",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-markdown": "1.0.0",
|
||||
"eslint-plugin-import": "2.17.2",
|
||||
"eslint-plugin-node": "8.0.1",
|
||||
"eslint-plugin-promise": "4.1.1",
|
||||
"eslint-plugin-standard": "4.0.0",
|
||||
"mocha": "6.1.4",
|
||||
"nyc": "14.1.1"
|
||||
"istanbul": "0.4.0",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
@@ -36,9 +23,8 @@
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||
"test-travis": "nyc --reporter=text npm test"
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user