.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / eslint / lib / cli-engine / hash.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/cli-engine/hash.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/eslint/lib/cli-engine/hash.js
new file mode 100644 (file)
index 0000000..6d7ef8b
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * @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;