From 188309a59cfe6fbd33e120dedf3bdfef3276d641 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 14 Nov 2024 22:50:04 +0100 Subject: infra(unicorn): consistent-function-scoping (#3255) --- src/modules/system/index.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/modules/system') diff --git a/src/modules/system/index.ts b/src/modules/system/index.ts index aec3525e..1c387e51 100644 --- a/src/modules/system/index.ts +++ b/src/modules/system/index.ts @@ -263,17 +263,17 @@ export class SystemModule extends ModuleBase { let suffix: string; let prefix = ''; - const digit = () => this.faker.string.numeric({ allowLeadingZeros: true }); switch (interfaceSchema) { case 'index': { - suffix = digit(); + suffix = this.faker.string.numeric(); break; } case 'slot': { - suffix = `${digit()}${ - this.faker.helpers.maybe(() => `f${digit()}`) ?? '' - }${this.faker.helpers.maybe(() => `d${digit()}`) ?? ''}`; + suffix = `${this.faker.string.numeric()}${ + this.faker.helpers.maybe(() => `f${this.faker.string.numeric()}`) ?? + '' + }${this.faker.helpers.maybe(() => `d${this.faker.string.numeric()}`) ?? ''}`; break; } @@ -283,10 +283,13 @@ export class SystemModule extends ModuleBase { } case 'pci': { - prefix = this.faker.helpers.maybe(() => `P${digit()}`) ?? ''; - suffix = `${digit()}s${digit()}${ - this.faker.helpers.maybe(() => `f${digit()}`) ?? '' - }${this.faker.helpers.maybe(() => `d${digit()}`) ?? ''}`; + prefix = + this.faker.helpers.maybe(() => `P${this.faker.string.numeric()}`) ?? + ''; + suffix = `${this.faker.string.numeric()}s${this.faker.string.numeric()}${ + this.faker.helpers.maybe(() => `f${this.faker.string.numeric()}`) ?? + '' + }${this.faker.helpers.maybe(() => `d${this.faker.string.numeric()}`) ?? ''}`; break; } } -- cgit v1.2.3