aboutsummaryrefslogtreecommitdiff
path: root/src/modules/internet
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-12-31 12:22:38 +0100
committerGitHub <[email protected]>2022-12-31 12:22:38 +0100
commit2d93e6f14a5ba976f87b71202bc4e011e38ee823 (patch)
tree09c569ac0aa920ba090667a938f67416134dca26 /src/modules/internet
parente296ff2d4f6f1aa56fe7c80722257bd0b316b30a (diff)
downloadfaker-2d93e6f14a5ba976f87b71202bc4e011e38ee823.tar.xz
faker-2d93e6f14a5ba976f87b71202bc4e011e38ee823.zip
chore: turn on padding-line-between-statements (#1691)
Diffstat (limited to 'src/modules/internet')
-rw-r--r--src/modules/internet/index.ts10
-rw-r--r--src/modules/internet/user-agent.ts2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index 2bac0668..8f5cc8bb 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -33,6 +33,7 @@ export class InternetModule {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
+
this[name] = this[name].bind(this);
}
}
@@ -173,10 +174,12 @@ export class InternetModule {
if (charMapping[char]) {
return charMapping[char];
}
+
if (char.charCodeAt(0) < 0x80) {
// Keep ASCII characters
return char;
}
+
// Final fallback return the Unicode char code value for Chinese, Japanese, Korean etc, base-36 encoded
return char.charCodeAt(0).toString(36);
})
@@ -224,6 +227,7 @@ export class InternetModule {
])}${lastName}${this.faker.number.int(99)}`;
break;
}
+
result = result.toString().replace(/'/g, '');
result = result.replace(/ /g, '');
return result;
@@ -493,6 +497,7 @@ export class InternetModule {
mac += validSep;
}
}
+
return mac;
}
@@ -536,6 +541,7 @@ export class InternetModule {
if (prefix.length >= length) {
return prefix;
}
+
if (memorable) {
if (prefix.match(consonant)) {
pattern = vowel;
@@ -543,16 +549,20 @@ export class InternetModule {
pattern = consonant;
}
}
+
const n = this.faker.number.int(94) + 33;
let char = String.fromCharCode(n);
if (memorable) {
char = char.toLowerCase();
}
+
if (!char.match(pattern)) {
return _password(length, memorable, pattern, prefix);
}
+
return _password(length, memorable, pattern, prefix + char);
};
+
return _password(len, memorable, pattern, prefix);
}
diff --git a/src/modules/internet/user-agent.ts b/src/modules/internet/user-agent.ts
index 005e31e6..40bc025f 100644
--- a/src/modules/internet/user-agent.ts
+++ b/src/modules/internet/user-agent.ts
@@ -70,6 +70,7 @@ export function generate(faker: Faker): string {
if (rand >= min && rand <= max) {
break;
}
+
min = min + obj[key];
}
}
@@ -219,6 +220,7 @@ export function generate(faker: Faker): string {
for (let x = 0; x < dots; x++) {
return_val += `.${faker.string.numeric({ allowLeadingZeros: true })}`;
}
+
return return_val;
};