UNPKG

@xapp/dynamo-service

Version:

A dynamo help class which will help maintain data integrity.

16 lines (15 loc) 521 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.randomString = void 0; function randomString(size = 5) { if (size < 0) { throw Error("Random string can not have a negative length."); } const useChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; let full = ""; for (let i = 0; i < size; ++i) { full += useChars.charAt(Math.floor(Math.random() * useChars.length)); } return full; } exports.randomString = randomString;