Comparing version 0.5.0 to 0.6.0
15
index.js
"use strict"; | ||
var objectAssign = require("object-assign"); | ||
var urllib = require("url"); | ||
@@ -18,3 +17,3 @@ var urlobj = require("urlobj"); | ||
{ | ||
this.options = objectAssign({}, defaultOptions, options); | ||
this.options = Object.assign({}, defaultOptions, options); | ||
@@ -37,2 +36,4 @@ this.clear(); | ||
delete this.values[url]; | ||
this.count--; | ||
} | ||
@@ -42,2 +43,3 @@ } | ||
{ | ||
this.count = 0; | ||
this.expiries = {}; | ||
@@ -61,2 +63,9 @@ this.values = {}; | ||
UrlCache.prototype.length = function() | ||
{ | ||
return this.count; | ||
}; | ||
UrlCache.prototype.set = function(url, value, expiryTime) | ||
@@ -73,2 +82,4 @@ { | ||
this.values[url] = value; | ||
this.count++; | ||
}; | ||
@@ -75,0 +86,0 @@ |
{ | ||
"name": "urlcache", | ||
"description": "URL key-value cache and store.", | ||
"version": "0.5.0", | ||
"description": "URL key-value cache.", | ||
"version": "0.6.0", | ||
"license": "MIT", | ||
@@ -20,3 +20,2 @@ "homepage": "https://github.com/stevenvachon/urlcache", | ||
"dependencies": { | ||
"object-assign": "^4.0.1", | ||
"urlobj": "0.0.8" | ||
@@ -26,12 +25,12 @@ }, | ||
"bhttp": "^1.2.1", | ||
"browserify": "^11.2.0", | ||
"chai": "^3.3.0", | ||
"chai-as-promised": "^5.1.0", | ||
"browserify": "^13.0.0", | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^5.2.0", | ||
"es6-promise": "^3.0.2", | ||
"mocha": "^2.3.3", | ||
"node-static": "~0.7.7", | ||
"uglify-js": "^2.5.0" | ||
"mocha": "^2.4.5", | ||
"object.assign": "^4.0.3", | ||
"uglify-js": "^2.6.1" | ||
}, | ||
"engines": { | ||
"node": ">= 0.10" | ||
"node": ">= 4" | ||
}, | ||
@@ -38,0 +37,0 @@ "scripts": { |
# urlcache [![NPM Version][npm-image]][npm-url] [![Bower Version][bower-image]][bower-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][david-image]][david-url] | ||
> URL key-value cache and store. | ||
> URL key-value cache. | ||
## Installation | ||
[Node.js](http://nodejs.org/) `>= 0.10` is required. To install, type this at the command line: | ||
[Node.js](http://nodejs.org/) `>= 0.10` is required; `< 4.0` will need an `Object.assign` polyfill. To install, type this at the command line: | ||
```shell | ||
npm install urlcache --save-dev | ||
npm install urlcache | ||
``` | ||
@@ -25,3 +25,3 @@ | ||
### .clear([url]) | ||
Removes `url` from cache. If `url` is not defined, *all* cached key value pairs will be removed. | ||
Removes the `url` key-value pair. If the `url` argument is not defined, *all* pairs will be removed. | ||
@@ -31,2 +31,5 @@ ### .get(url) | ||
### .length() | ||
Returns the number of stored key-value pairs. | ||
### .set(url, value[, expiryTime]) | ||
@@ -36,3 +39,3 @@ Stores `value` (any type) into `url` key. Optionally, define `expiryTime` to override `options.expiryTime`. | ||
cache.set("url", {"key":"value"}); | ||
cache.get("url"); //-> {"key":"value"} | ||
cache.get("url"); //=> {"key":"value"} | ||
@@ -47,3 +50,3 @@ cache.set("url", new Promise(function(resolve, reject) { | ||
Promise.resolve(cache.get("url")).then(function(value) { | ||
console.log(value); //-> "value" | ||
console.log(value); //=> "value" | ||
}); | ||
@@ -77,2 +80,3 @@ ``` | ||
## Changelog | ||
* 0.6.0 added `.length()` and removed `Object.assign()` polyfill | ||
* 0.5.0 removed use of Promises as they were unnecessary | ||
@@ -79,0 +83,0 @@ * 0.4.0 simpler `Promise`-based API |
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
7549
1
105
92
- Removedobject-assign@^4.0.1