aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-05-02 20:17:48 +0200
committerGitHub <[email protected]>2022-05-02 20:17:48 +0200
commit42d679566624aaedd01eb5c0d9fa54104008016c (patch)
tree2e55b529042b57059a44482302b4663c7bec9bd5 /src
parent4efaff90851cc9a24a9f4d9603e8fca7660a2d29 (diff)
downloadfaker-42d679566624aaedd01eb5c0d9fa54104008016c.tar.xz
faker-42d679566624aaedd01eb5c0d9fa54104008016c.zip
fix: replace deprecated arrayElement calls (#903)
Diffstat (limited to 'src')
-rw-r--r--src/random.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/random.ts b/src/random.ts
index 3cf4c0aa..87976828 100644
--- a/src/random.ts
+++ b/src/random.ts
@@ -360,12 +360,12 @@ export class Random {
do {
// randomly pick from the many faker methods that can generate words
- const randomWordMethod = this.arrayElement(wordMethods);
+ const randomWordMethod = this.faker.helpers.arrayElement(wordMethods);
result = randomWordMethod();
} while (!result || bannedChars.some((char) => result.includes(char)));
- return this.arrayElement(result.split(' '));
+ return this.faker.helpers.arrayElement(result.split(' '));
}
/**
@@ -419,7 +419,7 @@ export class Random {
* faker.random.locale() // 'el'
*/
locale(): string {
- return this.arrayElement(Object.keys(this.faker.locales));
+ return this.faker.helpers.arrayElement(Object.keys(this.faker.locales));
}
/**
@@ -485,7 +485,7 @@ export class Random {
let wholeString = '';
for (let i = 0; i < count; i++) {
- wholeString += this.arrayElement(charsArray);
+ wholeString += this.faker.helpers.arrayElement(charsArray);
}
return upcase ? wholeString.toUpperCase() : wholeString;
@@ -558,7 +558,7 @@ export class Random {
let wholeString = '';
for (let i = 0; i < count; i++) {
- wholeString += this.arrayElement(charsArray);
+ wholeString += this.faker.helpers.arrayElement(charsArray);
}
return wholeString;
@@ -610,13 +610,13 @@ export class Random {
let result = '';
if (!allowLeadingZeros && !bannedDigits.includes('0')) {
- result += this.arrayElement(
+ result += this.faker.helpers.arrayElement(
allowedDigits.filter((digit) => digit !== '0')
);
}
while (result.length < length) {
- result += this.arrayElement(allowedDigits);
+ result += this.faker.helpers.arrayElement(allowedDigits);
}
return result;