Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
287 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict'
|
---|
| 2 | var MurmurHash3 = require('imurmurhash')
|
---|
| 3 |
|
---|
| 4 | module.exports = function (uniq) {
|
---|
| 5 | if (uniq) {
|
---|
| 6 | var hash = new MurmurHash3(uniq)
|
---|
| 7 | return ('00000000' + hash.result().toString(16)).substr(-8)
|
---|
| 8 | } else {
|
---|
| 9 | return (Math.random().toString(16) + '0000000').substr(2, 8)
|
---|
| 10 | }
|
---|
| 11 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.