UNPKG

402 BJavaScriptView Raw
1'use strict';
2
3exports.__esModule = true;
4
5exports.default = function (prefix) {
6 prefix = prefix || '';
7
8 return prefix + (timestamp++).toString(36);
9};
10
11var timestamp = Date.now();
12
13/**
14 * 生成全局唯一的id
15 * @param {String} [prefix=''] 前缀字符串
16 * @return {String}
17 *
18 * @example
19 * guid(); // j7jv509c
20 * guid('prefix-'); // prefix-j7jv509d
21 */
22module.exports = exports['default'];
\No newline at end of file