Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
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.

Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
6
100%
Maintainers
1
Weekly downloads
 
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 19 Jun 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