Skip to content

Commit 612aaff

Browse files
committed
Node 4 compat
1 parent 735a8b7 commit 612aaff

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

.babelrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"loose": true,
5+
"targets": {
6+
"browsers": false,
7+
"node": 4
8+
}
9+
}]
10+
]
11+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
.nyc_output/
33
coverage/
4+
node4/

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module.exports = class CachePolicy {
9797
// The request method is understood by the cache and defined as being cacheable, and
9898
('GET' === this._method || 'HEAD' === this._method || ('POST' === this._method && this._hasExplicitExpiration())) &&
9999
// the response status code is understood by the cache, and
100-
understoodStatuses.includes(this._status) &&
100+
understoodStatuses.indexOf(this._status) !== -1 &&
101101
// the "no-store" cache directive does not appear in request or response header fields, and
102102
!this._rescc['no-store'] &&
103103
// the "private" response directive does not appear in the response, if the cache is shared, and
@@ -113,7 +113,7 @@ module.exports = class CachePolicy {
113113
// contains a public response directive.
114114
this._rescc.public || this._rescc['max-age'] || this._rescc['s-maxage'] ||
115115
// has a status code that is defined as cacheable by default
116-
statusCodeCacheableByDefault.includes(this._status)
116+
statusCodeCacheableByDefault.indexOf(this._status) !== -1
117117
));
118118
}
119119

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
{
22
"name": "http-cache-semantics",
3-
"version": "3.7.1",
3+
"version": "3.7.3",
44
"description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies",
5-
"main": "index.js",
65
"repository": "https://github.com/pornel/http-cache-semantics.git",
6+
"main": "node4/index.js",
77
"scripts": {
8-
"test": "mocha"
8+
"compile": "babel -d node4/ index.js; babel -d node4/test test",
9+
"prepublish": "npm run compile",
10+
"test": "npm run compile; mocha node4/test"
911
},
1012
"files": [
13+
"node4/index.js",
1114
"index.js",
1215
"test"
1316
],
1417
"author": "Kornel Lesiński <kornel@geekhood.net> (https://kornel.ski/)",
1518
"license": "BSD-2-Clause",
1619
"devDependencies": {
20+
"babel-cli": "^6.24.0",
21+
"babel-preset-env": "^1.3.2",
1722
"mocha": "^3.2.0"
1823
}
1924
}

0 commit comments

Comments
 (0)