First commit

This commit is contained in:
Josh Burman
2019-02-27 12:16:34 -05:00
commit 3cb44291cc
326 changed files with 51670 additions and 0 deletions

51
node_modules/range-parser/HISTORY.md generated vendored Executable file
View File

@ -0,0 +1,51 @@
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
==================
* perf: enable strict mode
1.0.2 / 2014-09-08
==================
* Support Node.js 0.6
1.0.1 / 2014-09-07
==================
* Move repository to jshttp
1.0.0 / 2013-12-11
==================
* Add repository to package.json
* Add MIT license
0.0.4 / 2012-06-17
==================
* Change ret -1 for unsatisfiable and -2 when invalid
0.0.3 / 2012-06-17
==================
* Fix last-byte-pos default to len - 1
0.0.2 / 2012-06-14
==================
* Add `.type`
0.0.1 / 2012-06-11
==================
* Initial release

23
node_modules/range-parser/LICENSE generated vendored Executable file
View File

@ -0,0 +1,23 @@
(The MIT License)
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

75
node_modules/range-parser/README.md generated vendored Executable file
View File

@ -0,0 +1,75 @@
# range-parser
[![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]
Range header field parser.
## Installation
```
$ npm install range-parser
```
## API
```js
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
```js
// 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.
```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)
[npm-image]: https://img.shields.io/npm/v/range-parser.svg
[npm-url]: https://npmjs.org/package/range-parser
[node-version-image]: https://img.shields.io/node/v/range-parser.svg
[node-version-url]: https://nodejs.org/endownload
[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

158
node_modules/range-parser/index.js generated vendored Executable file
View File

@ -0,0 +1,158 @@
/*!
* range-parser
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015-2016 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module exports.
* @public
*/
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) {
var index = str.indexOf('=')
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)
// -nnn
if (isNaN(start)) {
start = size - end
end = size - 1
// nnn-
} else if (isNaN(end)) {
end = size - 1
}
// limit last-byte-pos to current length
if (end > size - 1) {
end = size - 1
}
// invalid or unsatisifiable
if (isNaN(start) || isNaN(end) || start > end || start < 0) {
continue
}
// add range
ranges.push({
start: start,
end: end
})
}
if (ranges.length < 1) {
// unsatisifiable
return -1
}
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
}

87
node_modules/range-parser/package.json generated vendored Executable file
View File

@ -0,0 +1,87 @@
{
"_from": "range-parser@~1.2.0",
"_id": "range-parser@1.2.0",
"_inBundle": false,
"_integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=",
"_location": "/range-parser",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "range-parser@~1.2.0",
"name": "range-parser",
"escapedName": "range-parser",
"rawSpec": "~1.2.0",
"saveSpec": null,
"fetchSpec": "~1.2.0"
},
"_requiredBy": [
"/express",
"/send"
],
"_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
"_shasum": "f49be6b487894ddc40dcc94a322f611092e00d5e",
"_spec": "range-parser@~1.2.0",
"_where": "/Users/josh.burman/Projects/braid/node_modules/express",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca",
"url": "http://tjholowaychuk.com"
},
"bugs": {
"url": "https://github.com/jshttp/range-parser/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
{
"name": "James Wyatt Cready",
"email": "wyatt.cready@lanetix.com"
},
{
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
}
],
"deprecated": false,
"description": "Range header field string parser",
"devDependencies": {
"eslint": "2.11.1",
"eslint-config-standard": "5.3.1",
"eslint-plugin-promise": "1.1.0",
"eslint-plugin-standard": "1.3.2",
"istanbul": "0.4.3",
"mocha": "1.21.5"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"HISTORY.md",
"LICENSE",
"index.js"
],
"homepage": "https://github.com/jshttp/range-parser#readme",
"keywords": [
"range",
"parser",
"http"
],
"license": "MIT",
"name": "range-parser",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/range-parser.git"
},
"scripts": {
"lint": "eslint **/*.js",
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
},
"version": "1.2.0"
}