Browse Source

Node 4 compat

master v3.7.3
Kornel 8 years ago
parent
commit
612aaff9de
  1. 11
      .babelrc
  2. 1
      .gitignore
  3. 4
      index.js
  4. 11
      package.json

11
.babelrc

@ -0,0 +1,11 @@
{
"presets": [
["env", {
"loose": true,
"targets": {
"browsers": false,
"node": 4
}
}]
]
}

1
.gitignore

@ -1,3 +1,4 @@
node_modules/ node_modules/
.nyc_output/ .nyc_output/
coverage/ coverage/
node4/

4
index.js

@ -97,7 +97,7 @@ module.exports = class CachePolicy {
// The request method is understood by the cache and defined as being cacheable, and // The request method is understood by the cache and defined as being cacheable, and
('GET' === this._method || 'HEAD' === this._method || ('POST' === this._method && this._hasExplicitExpiration())) && ('GET' === this._method || 'HEAD' === this._method || ('POST' === this._method && this._hasExplicitExpiration())) &&
// the response status code is understood by the cache, and // the response status code is understood by the cache, and
understoodStatuses.includes(this._status) && understoodStatuses.indexOf(this._status) !== -1 &&
// the "no-store" cache directive does not appear in request or response header fields, and // the "no-store" cache directive does not appear in request or response header fields, and
!this._rescc['no-store'] && !this._rescc['no-store'] &&
// the "private" response directive does not appear in the response, if the cache is shared, and // the "private" response directive does not appear in the response, if the cache is shared, and
@ -113,7 +113,7 @@ module.exports = class CachePolicy {
// contains a public response directive. // contains a public response directive.
this._rescc.public || this._rescc['max-age'] || this._rescc['s-maxage'] || this._rescc.public || this._rescc['max-age'] || this._rescc['s-maxage'] ||
// has a status code that is defined as cacheable by default // has a status code that is defined as cacheable by default
statusCodeCacheableByDefault.includes(this._status) statusCodeCacheableByDefault.indexOf(this._status) !== -1
)); ));
} }

11
package.json

@ -1,19 +1,24 @@
{ {
"name": "http-cache-semantics", "name": "http-cache-semantics",
"version": "3.7.1", "version": "3.7.3",
"description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies",
"main": "index.js",
"repository": "https://github.com/pornel/http-cache-semantics.git", "repository": "https://github.com/pornel/http-cache-semantics.git",
"main": "node4/index.js",
"scripts": { "scripts": {
"test": "mocha" "compile": "babel -d node4/ index.js; babel -d node4/test test",
"prepublish": "npm run compile",
"test": "npm run compile; mocha node4/test"
}, },
"files": [ "files": [
"node4/index.js",
"index.js", "index.js",
"test" "test"
], ],
"author": "Kornel Lesiński <kornel@geekhood.net> (https://kornel.ski/)", "author": "Kornel Lesiński <kornel@geekhood.net> (https://kornel.ski/)",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",
"devDependencies": { "devDependencies": {
"babel-cli": "^6.24.0",
"babel-preset-env": "^1.3.2",
"mocha": "^3.2.0" "mocha": "^3.2.0"
} }
} }

Loading…
Cancel
Save