@@ -67,10 +67,13 @@ export class WordModule extends ModuleBase {
67
67
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
68
68
} = { }
69
69
) : string {
70
- const opts = typeof options === 'number' ? { length : options } : options ;
70
+ if ( typeof options === 'number' ) {
71
+ options = { length : options } ;
72
+ }
73
+
71
74
return this . faker . helpers . arrayElement (
72
75
filterWordListByLength ( {
73
- ...opts ,
76
+ ...options ,
74
77
wordList : this . faker . definitions . word . adjective ,
75
78
} )
76
79
) ;
@@ -137,10 +140,13 @@ export class WordModule extends ModuleBase {
137
140
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
138
141
} = { }
139
142
) : string {
140
- const opts = typeof options === 'number' ? { length : options } : options ;
143
+ if ( typeof options === 'number' ) {
144
+ options = { length : options } ;
145
+ }
146
+
141
147
return this . faker . helpers . arrayElement (
142
148
filterWordListByLength ( {
143
- ...opts ,
149
+ ...options ,
144
150
wordList : this . faker . definitions . word . adverb ,
145
151
} )
146
152
) ;
@@ -207,10 +213,13 @@ export class WordModule extends ModuleBase {
207
213
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
208
214
} = { }
209
215
) : string {
210
- const opts = typeof options === 'number' ? { length : options } : options ;
216
+ if ( typeof options === 'number' ) {
217
+ options = { length : options } ;
218
+ }
219
+
211
220
return this . faker . helpers . arrayElement (
212
221
filterWordListByLength ( {
213
- ...opts ,
222
+ ...options ,
214
223
wordList : this . faker . definitions . word . conjunction ,
215
224
} )
216
225
) ;
@@ -277,10 +286,13 @@ export class WordModule extends ModuleBase {
277
286
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
278
287
} = { }
279
288
) : string {
280
- const opts = typeof options === 'number' ? { length : options } : options ;
289
+ if ( typeof options === 'number' ) {
290
+ options = { length : options } ;
291
+ }
292
+
281
293
return this . faker . helpers . arrayElement (
282
294
filterWordListByLength ( {
283
- ...opts ,
295
+ ...options ,
284
296
wordList : this . faker . definitions . word . interjection ,
285
297
} )
286
298
) ;
@@ -347,10 +359,13 @@ export class WordModule extends ModuleBase {
347
359
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
348
360
} = { }
349
361
) : string {
350
- const opts = typeof options === 'number' ? { length : options } : options ;
362
+ if ( typeof options === 'number' ) {
363
+ options = { length : options } ;
364
+ }
365
+
351
366
return this . faker . helpers . arrayElement (
352
367
filterWordListByLength ( {
353
- ...opts ,
368
+ ...options ,
354
369
wordList : this . faker . definitions . word . noun ,
355
370
} )
356
371
) ;
@@ -417,10 +432,13 @@ export class WordModule extends ModuleBase {
417
432
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
418
433
} = { }
419
434
) : string {
420
- const opts = typeof options === 'number' ? { length : options } : options ;
435
+ if ( typeof options === 'number' ) {
436
+ options = { length : options } ;
437
+ }
438
+
421
439
return this . faker . helpers . arrayElement (
422
440
filterWordListByLength ( {
423
- ...opts ,
441
+ ...options ,
424
442
wordList : this . faker . definitions . word . preposition ,
425
443
} )
426
444
) ;
@@ -487,10 +505,13 @@ export class WordModule extends ModuleBase {
487
505
strategy ?: 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' ;
488
506
} = { }
489
507
) : string {
490
- const opts = typeof options === 'number' ? { length : options } : options ;
508
+ if ( typeof options === 'number' ) {
509
+ options = { length : options } ;
510
+ }
511
+
491
512
return this . faker . helpers . arrayElement (
492
513
filterWordListByLength ( {
493
- ...opts ,
514
+ ...options ,
494
515
wordList : this . faker . definitions . word . verb ,
495
516
} )
496
517
) ;
0 commit comments