UNPKG

async-test-util

Version:

Util-functions that are be useful in async tests

11 lines (10 loc) 296 B
/** * create a random string * @return {string} */ export default function randomString(length = 8, charset = 'abcdefghijklmnopqrstuvwxyz') { let text = ''; for (let i = 0; i < length; i++) text += charset.charAt(Math.floor(Math.random() * charset.length)); return text; }