Package Exports
- fast-hash-code
- fast-hash-code/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-hash-code) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fast-hash-code
Generate a hash from a string, simple and fast.
Installation
yarn add fast-hash-codeExample
import fastHashCode from 'fast-hash-code'
fastHashCode('Hello World!') // -969099747Options
forcePositive (new in v2.0.0) Description: Force the hash to be positive default: false note: The hash generated when true will be different from when false for the same string
import fastHashCode from 'fast-hash-code' const hashPositive = fastHashCode('Hello World!', { forcePositive: true }) console.log(hashPositive) // 1178383901
seed (new in v2.0.0) Description: Seed the hash, generate a different hash for each seed. default:
0import fastHashCode from 'fast-hash-code' const hashSeed = fastHashCode('Hello World!', { seed: 123 }) console.log(hashSeed) // 1597036056
caseSensitive (new in v2.0.0) Description: Force the hash to be case sensitive default: true
import fastHashCode from 'fast-hash-code' const hashCaseSensitive = fastHashCode('Hello World!', { caseSensitive: false }) console.log(hashCaseSensitive) // -217287203
References
https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/