aswi2020vldc-gitlab/templetes/node_modules/unique-slug/index.js @ 143404cb
1 | 3a515b92 | cagy | '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 | }
|