UNPKG

1.06 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8Object.defineProperty(exports, "__esModule", { value: true });
9const common_1 = require("@nestjs/common");
10const chance = require("chance");
11/**
12 * 随机数工具
13 */
14let RandomUtil = class RandomUtil {
15 /**
16 * 生成32位随机字符串
17 */
18 genRandomStr() {
19 return chance().string({ length: 32, pool: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' });
20 }
21};
22RandomUtil = __decorate([
23 common_1.Injectable()
24], RandomUtil);
25exports.RandomUtil = RandomUtil;