Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis-key

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-key

Redis key generator / function argument joiner

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
247
increased by9.78%
Maintainers
1
Weekly downloads
 
Created
Source

redis-key

Redis key generator / function argument joiner

This module is basically a shortcut for:

Array.prototype.slice.call(arguments).join(separator);

install

npm install redis-key

example

var rk = require('redis-key');

//default separator is ':'
var key = rk('product-collection', 'company', 'price-level');
//key = "product-collection:company:price-level"

Setting a default separator

var rk = require('redis-key').defaults('/');

//now the separator is '/'
var key = rk('part', 1, 3);
//key = "part/1/3"

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

I've been generating redis keys like this:

var key = ['part1', var1, var2, var3].join(':');

I thought it would be more concise to be able to do this:

var key = k('part1', var1, var2, var3);

And if my math is correct, it is more concise by 9 whole characters. Joy.

license

MIT

Keywords

FAQs

Package last updated on 23 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc