google_forms/node_modules/eslint/lib/cli-engine/hash.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-08-09 12:04:48 +00:00
/**
* @fileoverview Defining the hashing function in one place.
* @author Michael Ficarra
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const murmur = require("imurmurhash");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------
/**
* hash the given string
2024-08-21 06:34:30 +00:00
* @param {string} str the string to hash
* @returns {string} the hash
2024-08-09 12:04:48 +00:00
*/
function hash(str) {
return murmur(str).result().toString(36);
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = hash;