@muffin-dev/fixtures
v2.0.1
Published
Utility methods for generating random values.
Downloads
4
Readme
Muffin Dev - Fixtures
Utility methods for generating random values, such as numbers, strings, addresses, ...
Installation
npm i @muffin-dev/fixtures
Methods
generateFullName(): string
Returns a string with a random first name and a random last name, separated by a space.
getRandomFirstName(): string
getRandomLastName(): string
generateAddressName(maxStreetValue: number): string
Returns a string with a street type and a street name (ex.: "rue du Soleil").
generateAddress(maxStreetValue: number): string
Returns a string with a street number (from 1 to given max value), a street type and a street name (ex.: "5 rue du Soleil").
generateDate(min: Date, max: Date): Date
Returns a Date in the given interval.
generateRandomString(length: number, possibleChars: string): string
Returns a string with as many characters as length
parameter, containing the given possibleChars
.
The "possibleChars" parameter can be get from getCharacters()
.
getCharacters(
withLetters = true, // true to include lower-case letters
withCapitalLetters = true, // true to include upper-case letters
withNumbers = true, // true to include number from 0 to 9
withSymbols = false, // true to include symbols (-_.)
additionalChars = '' // Specify some characters to add to the generated string
): string
Returns a string with the selected character ensembles (letters, number, symbols).
generateNumber(min: number, max: number): number
Returns a numbere in the given interval.