henrybuilt-js-library
Advanced tools
Comparing version 1.8.226 to 1.8.227
{ | ||
"name": "henrybuilt-js-library", | ||
"version": "1.8.226", | ||
"version": "1.8.227", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -215,3 +215,3 @@ var _ = require('lodash'); | ||
return (...args) => { | ||
var newDiffValue = getDiffValue ? getDiffValue() : args[0]; | ||
var newDiffValue = getDiffValue ? getDiffValue(...args) : args[0]; | ||
@@ -218,0 +218,0 @@ if (newDiffValue === oldDiffValue) return cachedResult; |
@@ -88,4 +88,2 @@ describe('lib', () => { | ||
it('should work with string/number', () => { | ||
@@ -109,3 +107,28 @@ var ref = {count: 0}; | ||
}); | ||
it('should pass args', () => { | ||
var ref = {count: 0}; | ||
var diff = 0; | ||
var arg; | ||
var evaluate = () => { | ||
ref.count += 1; | ||
return ref.count; | ||
}; | ||
evaluate = lib.cache(evaluate, ({a}) => { | ||
arg = a; | ||
return diff; | ||
}); | ||
expect(evaluate({a: 'asdf'})).to.equal(1); | ||
expect(evaluate({a: 'asdf'})).to.equal(1); //use cached value because diff didn't change | ||
expect(arg).to.equal('asdf'); | ||
diff = 1; | ||
expect(evaluate({a: 'asdf'})).to.equal(2); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
878288
8164