-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmasksFakesGeneraters_docs_md
116 lines (78 loc) · 5.08 KB
/
masksFakesGeneraters_docs_md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
```javascript
// Generate a random date between a start point of millis after 01-Jan-1970 and a maximum set of milliseconds after that date
fakeDateMillisFromEpoch(startMillis, maxMillis)
// Generate a random date between now and a maximum number of milliseconds from now
fakeDateAfterNow(maxMillisFromNow)
// Generate a random date between a maximum number of milliseconds before now
fakeDateBeforeNow(maxMillisBeforeNow)
// Generate a whole number up to a maximum number of digits (any more than 15 are ignored)
fakeNumber(numberOfDigits)
// Generate a whole number between a given minimum and maximum number (inclusive)
fakeNumberBounded(minNumber, maxNumber)
// Generate a text representation of whole number to a specific number of digits (characters) in length (max 30)
fakePaddedNumberAsText(numberOfDigits)
// Generate a decimal number between 0.0 and 1.0 with up to 16 decimal places
fakeDecimal()
// Generate a decimal number with up to a specified number of significant places (e.g. '3' places -> 736.274473638742)
fakeDecimalSignificantPlaces(maxSignificantPlaces)
// Generate a currency amount with just 2 decimal places and up to a specified number of significant places (e.g. '3' places -> 736.27)
fakeMoneyAmountDecimal(maxSignificantPlaces)
// Generate a True or False value randomly
fakeBoolean()
// Generate a True or False value randomly but where True is likely for a specified percentage of invocations (e.g. 40 -> 40% likely to be True)
fakeBooleanWeighted(targetAvgPercentTrue)
// Return the first value on avererage the specified percentage of invocations otherwise returning second value
fakeOneOfTwoValuesWeighted(firstVal, secondVal, avgPercentFirstVal)
// Randomly return one value from a provided list
fakeValueFromList(listOfValues)
// Randomly return one value from a provided list but where values later in the list are more likely to be returned on average
fakeValueFromListWeighted(listOfValues)
// Generate an array of sub-documents with the specified size, where each item is randomly taken from the input list
fakeListOfSubDocs(numSumDocs, listOfValues)
// Generate string composed of the same character repeated the specified number of times
fakeNSameChars(char, amount)
// Generate string composed of random English alphabet uppercase characters repeated the specified number of times
fakeNAnyUpperChars(amount)
// Generate string composed of random English alphabet lowercase characters repeated the specified number of times
fakeNAnyLowerChars(amount)
// Generate a typical first name from an internal pre-defined list of common first names
fakeFirstName()
// Generate a typical last name from an internal pre-defined list of common last names
fakeLastName()
// Generate a typical first name and last name from an internal pre-defined list of names
fakeFirstAndLastName()
// Generate a random email address with random chars for the email id @ one of a few fixed .com domains
fakeEmailAddress(idChars)
// Generate a random IPv4 address in text format of 'xxx.xxx.xxx.xxx'
fakeIPAddress()
// Generate a typical street name from an internal pre-defined list of common street names
fakeStreetName()
// Generate a typical town name from an internal pre-defined list of common town names
fakeTownName()
// Randomly return the name of one of the countries in the world
fakeCountryName()
// Generate a random US-style zipcode/postcode (e.g. 10144)
fakeZipCode()
// Generate a typical company name from an internal pre-defined list of common company names
fakeCompanyName()
// Generate a random place with a typical name, an id and some geo coordinates
fakeLocationWithCoordinates()
// Replace the first specified number of characters in a field's value with 'x's
maskReplaceFirstPart(strOrNum, amount)
// Replace the last specified number of characters in a field's value with 'x's
maskReplaceLastPart(strOrNum, amount)
// Replace all the characters in a field's value with 'x's
maskReplaceAll(strOrNum)
// Change the value of a decimal number by adding or taking away a random amount up to a maximum percentage of its current value (e.g. change current value by + or - 10%)
maskAlterDecimal(currentValue, percent)
// Change the value of a whole number by adding or taking away a random amount up to a maximum percentage of its current value, rounded (e.g. change current value by + or - 10%)
maskAlterNumber(currentValue, percent)
// Change the value of a datetime by adding or taking away a random amount up to a maximum percentage of its current value (e.g. change current value by + or - 10%)
maskAlterDate(currentValue, maxChangeMillis)
// Return the same boolean value for a given percentage of time (e.g 40%), and for the rest of the time return the opposite value
maskAlterBoolean(currentValue, percentSameValue)
// Return the same value for a given percentage of time (e.g 40%), and for the rest of the time return a random value from the given list
maskAlterValueFromList(currentValue, percentSameValue, otherValuesList)
// Change on average a given percentage of the list members values to a random value from the provided alternative list
maskAlterListFromList(currentList, percentSameValues, otherValuesList)
```