Registry / storage / redis-key

redis-key

JSON →
library1.3.0jsnpmunverified

Redis key generator that joins arguments into a string with a configurable separator (default ':') and optional prefix. Version 1.3.0 is stable with no recent releases; it provides a concise alternative to manual array joining. Differentiator: minimal footprint — no dependencies, supports custom separator and prefix for consistent key namespacing.

npm install redis-key
INSTALL
IMPORT
SIG · REDIS-KEY
R
redis-key
storagejavascriptv1.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

redis-key (default function)
import rk from 'redis-key'
const { redisKey } = require('redis-key')
The package exports a single function as default. Use default import or require with 'require('redis-key').default' if using ESM.
defaults
import { defaults } from 'redis-key'
const defaults = require('redis-key').defaults
defaults is a named export that configures separator and prefix globally.
redis-key (CommonJS)
const rk = require('redis-key')
const { rk } = require('redis-key')
In CommonJS, the default export is the main function. Named destructuring will fail.

Shows importing the default function and the defaults export, using default separator, setting custom separator with prefix, and just custom separator.

import rk, { defaults } from 'redis-key'; // Use default separator ':' const key1 = rk('product-collection', 'company', 'price-level'); console.log(key1); // 'product-collection:company:price-level' // Change separator and prefix const config = defaults('/', 'app'); const key2 = config('user', 123); console.log(key2); // 'app/user/123' // Without prefix, just change separator const rk2 = defaults('/'); const key3 = rk2('part', 1, 3); console.log(key3); // 'part/1/3'
Debug
Known issues
gotchaCalling defaults() returns a new function but also mutates global state for subsequent plain rk() calls.
fix
Use the returned function for consistent separator/prefix instead of mixing rk() calls after defaults().
affects: >=0.0.0
gotchaPrefix is not applied when using the default export rk() — only when calling defaults().
fix
If you need a prefix, use defaults() to create a new function or manually prepend the prefix in your key.
affects: >=0.0.0
gotchaAll arguments are coerced to strings — objects become '[object Object]', arrays become comma-separated.
fix
Ensure all arguments are primitives (string, number) or explicitly convert to string.
affects: >=0.0.0
deprecatedPackage is in maintenance mode; no updates since 2015, but still works for simple use cases.
fix
Consider using template literals or arrays.join(':') for zero-dependency solution.
affects: 1.3.0
Errors
Common errors & fixes
TypeError: rk is not a function
Importing as named export instead of default import in CommonJS or ESM.
fix
Use: const rk = require('redis-key');  // CommonJS
 or import rk from 'redis-key';  // ESM
TypeError: rk(...) is not a function
Calling rk() without arguments returns undefined if defaults() returned empty.
fix
Ensure you have called defaults() correctly and stored the returned function.
Module not found: Can't resolve 'redis-key'
Package not installed or configured as external in bundler.
fix
Run: npm install redis-key
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
28
OpenAI (training)
1
Resources
redis-key — npm install redis-key · libregistry