memoize-cache-utils
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,3 @@ var stringifyKey = require('./stringify-key'); | ||
prefix = prefix || ''; | ||
func = func || function () { return '_default'; }; | ||
func = func || function () { return []; }; | ||
return function () { | ||
@@ -8,0 +8,0 @@ var args = Array.prototype.slice.call(arguments); |
{ | ||
"name": "memoize-cache-utils", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Utilities for memoize-cache", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,3 +13,13 @@ memoize-cache-utils | ||
It takes 2 arguments: | ||
* a function that returns a key (if undefined the default will be a function returning null). Valid outputs are: null, a string or an object. null will default to the key "_default" a string will be used as it is and objects wiil be serialized and hashed. | ||
* an optional prefix. This will be added to the key (default '') | ||
* a function that returns a key (if undefined the default will be a function returning null). Valid outputs are: undefined, null, a string or an object. | ||
* a prefix. It is added to the key (default ''). | ||
If the function is undefined, it will be replaced with a function returning "_default". | ||
The following transformation will be applied to the result of the function: | ||
* null will be returned as it is | ||
* a non empty string will be used as it is | ||
* objects/numbers will be serialized and hashed | ||
keys-getter | ||
=========== | ||
It is equivalent to key-getter but it expects a function to return an array of keys. It defaults to [] (empty array). |
@@ -35,2 +35,6 @@ var assert = require('chai').assert; | ||
it('return default', function () { | ||
var getKey3 = keyGetter(); | ||
assert.equal(getKey3('1'), '_default'); | ||
}); | ||
}); |
@@ -35,2 +35,6 @@ var assert = require('chai').assert; | ||
it('return default', function () { | ||
var getKey3 = keysGetter(); | ||
assert.deepEqual(getKey3('1'), []); | ||
}); | ||
}); |
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
7086
106
25