Add files
This commit is contained in:
commit
a2f355ac82
1757 changed files with 320133 additions and 0 deletions
1
node_modules/parse-cache-control/.npmignore
generated
vendored
Normal file
1
node_modules/parse-cache-control/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
26
node_modules/parse-cache-control/LICENSE
generated
vendored
Normal file
26
node_modules/parse-cache-control/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
Copyright (c) 2012-2014, Walmart and other contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
* * *
|
5
node_modules/parse-cache-control/README.md
generated
vendored
Normal file
5
node_modules/parse-cache-control/README.md
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# parse-cache-control
|
||||
|
||||
Simple function to parse `Cache-Control` headers. Taken from [Wreck](https://github.com/hapijs/wreck).
|
||||
|
||||
See `test.js` for usage.
|
37
node_modules/parse-cache-control/index.js
generated
vendored
Normal file
37
node_modules/parse-cache-control/index.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
module.exports = function parseCacheControl(field) {
|
||||
|
||||
if (typeof field !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
Cache-Control = 1#cache-directive
|
||||
cache-directive = token [ "=" ( token / quoted-string ) ]
|
||||
token = [^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+
|
||||
quoted-string = "(?:[^"\\]|\\.)*"
|
||||
*/
|
||||
|
||||
// 1: directive = 2: token 3: quoted-string
|
||||
var regex = /(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g;
|
||||
|
||||
var header = {};
|
||||
var err = field.replace(regex, function($0, $1, $2, $3) {
|
||||
var value = $2 || $3;
|
||||
header[$1] = value ? value.toLowerCase() : true;
|
||||
return '';
|
||||
});
|
||||
|
||||
if (header['max-age']) {
|
||||
try {
|
||||
var maxAge = parseInt(header['max-age'], 10);
|
||||
if (isNaN(maxAge)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
header['max-age'] = maxAge;
|
||||
}
|
||||
catch (err) { }
|
||||
}
|
||||
|
||||
return (err ? null : header);
|
||||
};
|
22
node_modules/parse-cache-control/package.json
generated
vendored
Normal file
22
node_modules/parse-cache-control/package.json
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "parse-cache-control",
|
||||
"version": "1.0.1",
|
||||
"description": "Parse Cache-Control headers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tape test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/roryf/parse-cache-control.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^3.5.0"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/hapijs/wreck/raw/master/LICENSE"
|
||||
}
|
||||
]
|
||||
}
|
31
node_modules/parse-cache-control/test.js
generated
vendored
Normal file
31
node_modules/parse-cache-control/test.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
var test = require('tape');
|
||||
var parseCacheControl = require('./index');
|
||||
|
||||
test('parseCacheControl', function (t) {
|
||||
var header = parseCacheControl('must-revalidate, max-age=3600');
|
||||
t.ok(header);
|
||||
t.equal(header['must-revalidate'], true);
|
||||
t.equal(header['max-age'], 3600);
|
||||
|
||||
header = parseCacheControl('must-revalidate, max-age="3600"');
|
||||
t.ok(header);
|
||||
t.equal(header['must-revalidate'], true);
|
||||
t.equal(header['max-age'], 3600);
|
||||
|
||||
header = parseCacheControl('must-revalidate, b =3600');
|
||||
t.notOk(header);
|
||||
|
||||
header = parseCacheControl('must-revalidate, max-age=a3600');
|
||||
t.notOk(header);
|
||||
|
||||
header = parseCacheControl(123);
|
||||
t.notOk(header);
|
||||
|
||||
header = parseCacheControl(null);
|
||||
t.notOk(header);
|
||||
|
||||
header = parseCacheControl(undefined);
|
||||
t.notOk(header);
|
||||
|
||||
t.end();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue