dump-value
v1.1.1
Published
Generate dump value to test. The value type can be: number, character, name, sentence, paragraph
Downloads
6
Maintainers
Readme
dump-value
Generate dump value for testing. The value type can be: number, character, string
Install
npm install dump-value --save
Usage
const { getRandomName } = require('dump-value');
console.log(getRandomName(['male'],['europe','america']));
APIs
getRandomInt(max)
Get a random number in range of 0 -> max
getRandomIntRange(min, max)
Get a random number in range of min -> max
getRandomChar()
Get a random character in range of a
-> z
or A
-> Z
getRandomCharLowerCase()
Get a random lower case character: a
-> z
getRandomCharUpperCase()
Get a random upper case character: A
-> Z
getRandomName(regions, gender)
Get a random name by given genders and regions, based on list of most popular given names
gender
: can be'male', 'female'
or'all'
(default value).regions
: a string or array of string to represent the regions ('africa', 'america', 'asia', 'europe', 'oceania'
). The empty array[]
means that all values have been selected
Some shortcut of this function:
|Short|Short|Full|
|---|:---|:---|
|getRandomName()
| getRandomName([],'all')
| getRandomName(['africa', 'america', 'asia', 'europe', 'oceania'],'all')
|
|getRandomName('asia')
| getRandomName(['asia'],'all')
||
|getRandomName([],'male')
| getRandomName(['africa', 'america', 'asia', 'europe', 'oceania'],'male')
||