Comparing version 1.0.0 to 2.0.0
(function(){ | ||
var _global = this; | ||
const createBuffer = | ||
Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow | ||
? Buffer.from | ||
: // support for Node < 5.10 | ||
val => new Buffer(val); | ||
const createBuffer = (val) => new TextEncoder().encode(val) | ||
@@ -18,3 +14,3 @@ /** | ||
* | ||
* @param {Buffer} str ASCII only | ||
* @param {Uint8Array | string} str ASCII only | ||
* @param {number} seed Positive integer only | ||
@@ -24,3 +20,3 @@ * @return {number} 32-bit positive integer hash | ||
function MurmurHashV2(str, seed) { | ||
if (!Buffer.isBuffer(str)) str = createBuffer(str); | ||
if (typeof str === 'string') str = createBuffer(str); | ||
var | ||
@@ -71,3 +67,3 @@ l = str.length, | ||
* | ||
* @param {Buffer} key ASCII only | ||
* @param {Uint8Array | string} key ASCII only | ||
* @param {number} seed Positive integer only | ||
@@ -77,3 +73,3 @@ * @return {number} 32-bit positive integer hash | ||
function MurmurHashV3(key, seed) { | ||
if (!Buffer.isBuffer(key)) key = createBuffer(key); | ||
if (typeof key === 'string') key = createBuffer(key); | ||
@@ -80,0 +76,0 @@ var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i; |
{ | ||
"name" : "murmurhash", | ||
"version" : "1.0.0", | ||
"version" : "2.0.0", | ||
"description" : "A Node.js module for the optimized JavaScript implementation of the MurmurHash algorithms.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -22,2 +22,4 @@ # node-murmurhash | ||
To support older browsers you need to use TextEncoder [polyfill](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder#Polyfill) | ||
or in node.js | ||
@@ -24,0 +26,0 @@ |
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
8948
6
155
53