aboutsummaryrefslogtreecommitdiff
path: root/src/system.ts
diff options
context:
space:
mode:
authorPiotr Kuczynski <[email protected]>2022-04-19 22:38:17 +0200
committerGitHub <[email protected]>2022-04-19 22:38:17 +0200
commit00b9d4be4bff3b3f64edf163768af71c99bceed1 (patch)
tree0fa0e76b036c11c38eea251a8c4d371875810eed /src/system.ts
parentcb746cb466743a219c0e3845edb29527a06b0a35 (diff)
downloadfaker-00b9d4be4bff3b3f64edf163768af71c99bceed1.tar.xz
faker-00b9d4be4bff3b3f64edf163768af71c99bceed1.zip
chore: prefer string templates over string concatenation (#732)
Diffstat (limited to 'src/system.ts')
-rw-r--r--src/system.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/system.ts b/src/system.ts
index 16ddd876..05d0bf44 100644
--- a/src/system.ts
+++ b/src/system.ts
@@ -54,9 +54,9 @@ export class System {
* faker.system.fileName() // 'self_enabling_accountability_toys.kpt'
*/
fileName(): string {
- let str = this.faker.random.words();
- str = str.toLowerCase().replace(/\W/g, '_') + '.' + this.fileExt();
- return str;
+ const str = this.faker.random.words().toLowerCase().replace(/\W/g, '_');
+
+ return `${str}.${this.fileExt()}`;
}
/**
@@ -68,10 +68,9 @@ export class System {
* faker.system.commonFileName('txt') // 'global_borders_wyoming.txt'
*/
commonFileName(ext?: string): string {
- let str = this.faker.random.words();
- str = str.toLowerCase().replace(/\W/g, '_');
- str += '.' + (ext || this.commonFileExt());
- return str;
+ const str = this.faker.random.words().toLowerCase().replace(/\W/g, '_');
+
+ return `${str}.${ext || this.commonFileExt()}`;
}
/**