Comparing version 1.2.0 to 1.3.0
10
index.js
@@ -6,3 +6,11 @@ "use strict"; | ||
function defaults (separator) { | ||
function defaults (separator, prefix) { | ||
if (prefix) { | ||
return function redisKey() { | ||
var args = Array.prototype.slice.call(arguments); | ||
args.unshift(prefix); | ||
return args.join(separator); | ||
} | ||
} | ||
return function redisKey() { | ||
@@ -9,0 +17,0 @@ return Array.prototype.slice.call(arguments).join(separator) |
{ | ||
"name": "redis-key", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Redis key generator / function argument joiner", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -40,2 +40,10 @@ redis-key | ||
api | ||
--- | ||
### .defaults([separator, [prefix]]) | ||
* separator - [string] the character[s] to put between the tokens that make up your key (default ':') | ||
* prefix - [string] an additional token that is prefixed to the key | ||
motivation | ||
@@ -42,0 +50,0 @@ ---------- |
@@ -15,1 +15,9 @@ var test = require('tape'); | ||
}); | ||
test('custom separator and prefix', function (t) { | ||
var r = rk.defaults('/', 'v1'); | ||
t.equal('v1/a/b/c/d', r('a','b','c','d')); | ||
t.end(); | ||
}); |
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
2582
31
69