Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « lib « unique-slug « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1bac84d95d73070a1c623d59816dae781b6f1a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
'use strict'
var MurmurHash3 = require('imurmurhash')

module.exports = function (uniq) {
  if (uniq) {
    var hash = new MurmurHash3(uniq)
    return ('00000000' + hash.result().toString(16)).slice(-8)
  } else {
    return (Math.random().toString(16) + '0000000').slice(2, 10)
  }
}