Urara-Blog/node_modules/.pnpm-store/v3/files/74/baedb981f40cbe026dd7d1ec3a46b191105de64b96ade67ab149cfa5f54630cdb93303f504935ea1f5e3d0127ab33373d374a34ea69bfc60197bf2d3b88dfe
2022-08-14 01:14:53 +08:00

35 lines
1 KiB
Text

/**
* @fileoverview Defining the hashing function in one place.
* @author Michael Ficarra
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const murmur = require("imurmurhash");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------
/**
* hash the given string
* @param {string} str the string to hash
* @returns {string} the hash
*/
function hash(str) {
return murmur(str).result().toString(36);
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = hash;