File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 1
1
import { fake } from './core/core' ;
2
- import { data } from './first-name.json' ;
2
+ import { data as localeDefault } from './first-name.json' ;
3
3
import { NameOptions } from './full-name' ;
4
4
import { rand } from './rand' ;
5
5
@@ -30,14 +30,10 @@ export function randFirstName<Options extends NameOptions = never>(
30
30
) {
31
31
const withAccents = options ?. withAccents ?? false ;
32
32
const gender = options ?. gender ?? rand ( [ 'male' , 'female' ] ) ;
33
- const locale = options ?. locale ;
33
+ const data = options ?. locale || localeDefault ;
34
34
35
35
const names : string [ ] = withAccents
36
- ? locale
37
- ? locale ?. withAccents [ gender ]
38
- : data . withAccents [ gender ]
39
- : locale
40
- ? locale ?. withoutAccents [ gender ]
36
+ ? data . withAccents [ gender ]
41
37
: data . withoutAccents [ gender ] ;
42
38
43
39
return fake ( names , options ) ;
You can’t perform that action at this time.
0 commit comments