Comparing version 0.2.0 to 0.3.0
var units = { | ||
year: 31556926 | ||
, month: 2629743 | ||
year: 31536000 | ||
, month: 2592000 | ||
, week: 604800 | ||
@@ -58,2 +58,6 @@ , day: 86400 | ||
if (!str || typeof str !== 'string') { | ||
return 0 | ||
} | ||
var subs = str.split(/\sand\s/) | ||
@@ -74,8 +78,4 @@ | ||
module.exports.units = units | ||
module.exports.values = values | ||
function setExpiration(res, time) { | ||
module.exports.getSeconds = getSeconds | ||
module.exports.setExpiration = function(res, time) { | ||
var seconds = typeof time === 'number' ? time : getSeconds(time) | ||
@@ -85,4 +85,14 @@ var date = new Date() | ||
res['Expires'] = date.toUTCString() | ||
res['Cache-Control'] = 'max-age='+seconds | ||
res['expires'] = date.toUTCString() | ||
res['cache-control'] = 'max-age='+seconds | ||
return res | ||
} | ||
module.exports = { | ||
units:units, | ||
values:values, | ||
getSeconds:getSeconds, | ||
setExpiration:setExpiration | ||
} |
{ | ||
"name": "expire", | ||
"version": "0.2.0", | ||
"name": "expire", | ||
"version": "0.3.0", | ||
"description": "Convenient utility for client-side expiration", | ||
@@ -8,4 +8,8 @@ "keywords": ["expiration", "expire"], | ||
"author": "Weltschmerz <chlavois@gmail.com>", | ||
"dependencies": { | ||
"vows": "0.6.3" | ||
}, | ||
"main": "lib/expire.js", | ||
"scripts": { "test" : "node test/test.js" }, | ||
"engines": { "node": ">= 0.4.0" } | ||
} |
@@ -5,4 +5,6 @@ ## Expire | ||
Expiration Date is a convenient little utility for abstracting some of the work you might do to afford robust cache strings. | ||
`npm test expire` | ||
Expire is a convenient little utility for abstracting some of the work you might do to afford robust cache strings. | ||
```js | ||
@@ -9,0 +11,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
22237
6
0
698
39
1
1
1
+ Addedvows@0.6.3
+ Addedeyes@0.1.8(transitive)
+ Addedvows@0.6.3(transitive)