UNPKG

@agreed/core

Version:

agreed is a mock server and test client, agreed will be helper for Consumer Driven Contract

20 lines (16 loc) 414 B
function getRandom(length = 5) { var char = "abcdefghijklmnopqrstuvwxyz0123456789"; var charLength = char.length; var random = ""; for (var i = 0; i < length; i++) { random += char[Math.floor(Math.random() * charLength)]; } return random; } function randomString(value) { if (typeof value === "number") { return getRandom(value); } return getRandom(); } module.exports = randomString;