Sha256: 96589233d547a6ce039dbf1a067214dd89ec02de6ca0057badb76780a01b478c

Contents?: true

Size: 1.04 KB

Versions: 44

Compression:

Stored size: 1.04 KB

Contents

/**
 * @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;

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
govuk_publishing_components-17.6.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.5.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.4.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.3.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.2.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.1.1 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.1.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-17.0.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.29.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.28.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.27.1 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.27.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.26.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.25.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.24.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.23.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.22.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.21.0 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.20.1 node_modules/standard/node_modules/eslint/lib/util/hash.js
govuk_publishing_components-16.20.0 node_modules/standard/node_modules/eslint/lib/util/hash.js