Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("stash",[],t):"object"==typeof exports?exports.stash=t():e.stash=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"clear",(function(){return u})),n.d(t,"stash",(function(){return i})),n.d(t,"retrieve",(function(){return f}));var r=function(e){return e?sessionStorage:localStorage},o=function(e){return"".concat(e).concat("_date")},u=function(e,t){var n=r(t);delete n[e],delete n[o(e)]},i=function(e,t,n){var u=r(n),i=Math.floor((new Date).getTime()/1e3);u.setItem(e,JSON.stringify(t)),u.setItem(o(e),i.toString())},f=function(e,t,n){var i=r(n),f=+i.getItem(o(e)),a=i.getItem(e);if(a){var c,l=t>0;if(l&&f){var s=+new Date,d=1e3*+new Date(f);c=Math.ceil((s-d)/1e3/60)>=t}if(!l||f&&!c)try{a=JSON.parse(a)}catch(e){}else u(e,n),a=null}return a};t.default={stash:i,clear:u,retrieve:f}}]).default})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("stash",[],t):"object"==typeof exports?exports.stash=t():e.stash=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"clear",(function(){return u})),n.d(t,"stash",(function(){return f})),n.d(t,"retrieve",(function(){return i}));var r=function(e){return e?sessionStorage:localStorage},o=function(e){return"".concat(e).concat("_date")},u=function(e,t){var n=r(t);delete n[e],delete n[o(e)]},f=function(e,t,n){var u=r(n),f=Math.floor((new Date).getTime()/1e3);u.setItem(e,JSON.stringify(t)),u.setItem(o(e),f.toString())},i=function(e,t,n){var f=r(n),i=+f.getItem(o(e)),a=f.getItem(e);if(a){var c,l=t>0;if(l&&i){var s=+new Date,d=+new Date(1e3*i);c=Math.floor((s-d)/1e3/60)>=t}if(!l||i&&!c)try{a=JSON.parse(a)}catch(e){}else u(e,n),a=null}return a};t.default={stash:f,clear:u,retrieve:i}}]).default})); | ||
//# sourceMappingURL=index.js.map |
@@ -31,4 +31,4 @@ // constants | ||
const nowMs = +(new Date()); | ||
const storageMs = +(new Date(storageDate)) * 1000; | ||
const minutesOld = Math.ceil((nowMs - storageMs) / 1000 / 60); | ||
const storageMs = +(new Date(storageDate * 1000)); | ||
const minutesOld = Math.floor((nowMs - storageMs) / 1000 / 60); | ||
expired = minutesOld >= minutesToExpiration; | ||
@@ -35,0 +35,0 @@ } |
112
package.json
{ | ||
"name": "mini-stash", | ||
"version": "1.0.0", | ||
"description": "ES browser storage helper", | ||
"author": "Dean Verleger", | ||
"license": "ISC", | ||
"homepage": "https://github.com/deanbot/mini-stash#readme", | ||
"bugs": { | ||
"url": "https://github.com/deanbot/mini-stash/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/deanbot/mini-stash.git" | ||
}, | ||
"keywords": [ | ||
"local storage", | ||
"session storage", | ||
"browser storage", | ||
"storage", | ||
"caching", | ||
"browser caching", | ||
"ES" | ||
], | ||
"main": "lib/index.js", | ||
"module": "libm/index.js", | ||
"types": "lib/index.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
"clean": "shx rm -rf lib libm", | ||
"prepare": "npm run clean", | ||
"prepublishOnly": "npm run build", | ||
"build": "npm run build:umd && npm run build:esnext && npm run build:ts-defs", | ||
"build:umd": "cross-env NODE_ENV=production webpack --config ./webpack.config.js", | ||
"build:esnext": "tsc -p tsconfig.esnext.json", | ||
"build:ts-defs": "tsc --declaration --emitDeclarationOnly", | ||
"build:dev": "webpack --config ./webpack.config.js", | ||
"build:dev-watch": "webpack --config ./webpack.config.js --progress --colors --watch", | ||
"serve": "http-server ./lib -o", | ||
"start": "npm run clean && npm run build:dev && npm-run-all --parallel build:dev-watch serve", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"babel-loader": "^8.1.0", | ||
"cross-env": "^7.0.2", | ||
"dotenv": "^8.2.0", | ||
"fs-extra": "^7.0.1", | ||
"html-webpack-plugin": "^4.3.0", | ||
"http-server": "^0.12.3", | ||
"npm-run-all": "^4.1.5", | ||
"shx": "^0.3.2", | ||
"typescript": "^3.9.3", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11" | ||
} | ||
"name": "mini-stash", | ||
"version": "1.0.1", | ||
"description": "ES browser storage helper", | ||
"author": "Dean Verleger", | ||
"license": "ISC", | ||
"homepage": "https://github.com/deanbot/mini-stash#readme", | ||
"bugs": { | ||
"url": "https://github.com/deanbot/mini-stash/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/deanbot/mini-stash.git" | ||
}, | ||
"keywords": [ | ||
"local storage", | ||
"session storage", | ||
"browser storage", | ||
"storage", | ||
"caching", | ||
"browser caching", | ||
"ES" | ||
], | ||
"main": "lib/index.js", | ||
"module": "libm/index.js", | ||
"types": "lib/index.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
"clean": "shx rm -rf lib libm", | ||
"prepare": "npm run clean", | ||
"prepublishOnly": "npm run build", | ||
"build": "npm run build:umd && npm run build:esnext && npm run build:ts-defs", | ||
"build:umd": "cross-env NODE_ENV=production webpack --config ./webpack.config.js", | ||
"build:esnext": "tsc -p tsconfig.esnext.json", | ||
"build:ts-defs": "tsc --declaration --emitDeclarationOnly", | ||
"build:dev": "webpack --config ./webpack.config.js", | ||
"build:dev-watch": "webpack --config ./webpack.config.js --progress --colors --watch", | ||
"serve": "http-server ./lib -o", | ||
"start": "npm run clean && npm run build:dev && npm-run-all --parallel build:dev-watch serve", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.9.6", | ||
"@babel/preset-env": "^7.9.6", | ||
"@babel/preset-typescript": "^7.9.0", | ||
"babel-loader": "^8.1.0", | ||
"cross-env": "^7.0.2", | ||
"dotenv": "^8.2.0", | ||
"fs-extra": "^7.0.1", | ||
"html-webpack-plugin": "^4.3.0", | ||
"http-server": "^0.12.3", | ||
"npm-run-all": "^4.1.5", | ||
"shx": "^0.3.2", | ||
"typescript": "^3.9.3", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
171359