Socket
Book a DemoInstallSign in
Socket

chash

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chash

hash a value to a consistent number within a specified range. in goes key out goes number that's it.

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

Build Status

node-chash

hash a value to a consistent number within a specified range. in goes key out goes number that's it.

example

var chash = require('chash');

var colors = ['red','blue','green','purple']
, bobscolor = chash('bob',colors.length)
, ryanscolor = chash('ryan',colors.length)
, suescolor = chash('sue',colors.length)
;

console.log('bob will always be',colors[bobscolor]);
console.log('ryan will always be',colors[ryanscolor]);
console.log('sue will always be',colors[suescolor]);

notes

random distribution

?_?

Keywords

consistent

FAQs

Package last updated on 09 Jul 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