good-guy-http
Advanced tools
Comparing version 1.7.1 to 1.7.2
var Promise = require('bluebird'); | ||
var clone = require('clone'); | ||
@@ -23,3 +24,3 @@ module.exports = function(maxEntries) { | ||
this._markAsRecent(key); | ||
return Promise.resolve(entry); | ||
return Promise.resolve(clone(entry)); | ||
} else { | ||
@@ -31,2 +32,3 @@ return Promise.resolve(undefined); | ||
store: function(key, value) { | ||
value = clone(value); | ||
var entry = this._entryMap[key]; | ||
@@ -33,0 +35,0 @@ if (entry !== undefined) { |
{ | ||
"name": "good-guy-http", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "The opinionated sane HTTP client with a good guy approach.", | ||
@@ -20,2 +20,3 @@ "main": "lib/index.js", | ||
"circuit-breaker-js": "Schibsted-Tech-Polska/circuit-breaker-js#v0.0.2", | ||
"clone": "1.0.2", | ||
"request": "2.69.0", | ||
@@ -22,0 +23,0 @@ "underscore": "1.8.3", |
@@ -16,2 +16,25 @@ var assert = require('assert'); | ||
it('should store values rather than references to elements', function(done) { | ||
var lru = new LRUCache(2); | ||
var original = {answer: 42}; | ||
lru.store('hitchhiker', original).then(function() { | ||
original.answer = 43; | ||
return lru.retrieve('hitchhiker'); | ||
}).then(function(object) { | ||
assert.deepEqual(object, {answer: 42}); | ||
}).then(done).catch(done); | ||
}); | ||
it('should return values rather than references to elements', function(done) { | ||
var lru = new LRUCache(2); | ||
lru.store('hitchhiker', {answer: 42}).then(function() { | ||
return lru.retrieve('hitchhiker'); | ||
}).then(function(object) { | ||
object.answer = 43; | ||
return lru.retrieve('hitchhiker'); | ||
}).then(function(object) { | ||
assert.deepEqual(object, {answer: 42}); | ||
}).then(done).catch(done); | ||
}); | ||
it('should throw away oldest element when nothing is retrieved', function(done) { | ||
@@ -18,0 +41,0 @@ var lru = new LRUCache(3); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
89861
2107
6
5
+ Addedclone@1.0.2
+ Addedclone@1.0.2(transitive)