File tree Expand file tree Collapse file tree 5 files changed +22
-14
lines changed Expand file tree Collapse file tree 5 files changed +22
-14
lines changed Original file line number Diff line number Diff line change
1
+ <a name =" 2.0.0 " ></a >
2
+ # [ 2.0.0] ( https://github.com/faker-javascript/profession ) (2022-01-09)
3
+
4
+ ### BREAKING CHANGES
5
+
6
+ * New function ` profession ` istead of ` fakeProfession `
7
+
1
8
<a name =" 1.0.0 " ></a >
2
9
# [ 1.0.0] ( https://github.com/faker-javascript/profession ) (2022-01-09)
3
10
* Initial release
Original file line number Diff line number Diff line change @@ -15,19 +15,19 @@ $ npm install --save @fakerjs/profession
15
15
## Usage
16
16
17
17
``` js
18
- import fakeProfession from ' @fakerjs/profession' ;
18
+ import profession from ' @fakerjs/profession' ;
19
19
20
- fakeProfession ();
20
+ profession ();
21
21
// => Software Engineer
22
22
23
- fakeProfession ({rank: true });
23
+ profession ({rank: true });
24
24
// => Lead Software Engineer
25
25
26
- fakeProfession ({rank: true , locale: ' en_US' });
26
+ profession ({rank: true , locale: ' en_US' });
27
27
// => Lead Software Engineer
28
28
29
- // Allowed ranks : true, false
30
- // Allowed locales : en_US
29
+ // Allowed rank : true, false
30
+ // Allowed locale : en_US
31
31
```
32
32
33
33
## Tests
Original file line number Diff line number Diff line change 1
- export default function fakeProfession ( options ) {
1
+ export default function profession ( options ) {
2
2
options = options || { } ;
3
3
let ranks = {
4
4
"en_US" : [
@@ -401,7 +401,7 @@ export default function fakeProfession(options) {
401
401
"Warehouse Manager"
402
402
]
403
403
} ;
404
- let locale = ( ( options . locale === undefined ) ? 'en_US' : options . locale ) ;
404
+ let locale = options . locale || 'en_US' ;
405
405
let randomProfession = professions [ locale ] [ Math . floor ( Math . random ( ) * professions [ locale ] . length ) ] ;
406
406
if ( options . rank ) {
407
407
return ranks [ locale ] [ Math . floor ( Math . random ( ) * ranks [ locale ] . length ) ] + ' ' + randomProfession ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @fakerjs/profession" ,
3
- "version" : " 1 .0.0" ,
3
+ "version" : " 2 .0.0" ,
4
4
"description" : " Profession package provides functionality to generate a fake profession value." ,
5
5
"license" : " MIT" ,
6
6
"repository" : " faker-javascript/profession" ,
25
25
],
26
26
"keywords" : [
27
27
" fakerjs" ,
28
+ " faker" ,
28
29
" fake" ,
29
30
" random" ,
30
31
" profession" ,
Original file line number Diff line number Diff line change 1
- import fakeProfession from './index.js' ;
1
+ import profession from './index.js' ;
2
2
import test from 'ava' ;
3
3
4
- test ( 'fakeProfession return type to be string' , t => {
5
- t . is ( typeof fakeProfession ( ) , 'string' ) ;
4
+ test ( 'profession return type to be string' , t => {
5
+ t . is ( typeof profession ( ) , 'string' ) ;
6
6
} ) ;
7
7
8
- test ( 'fakeProfession with rank return type to be string' , t => {
9
- t . is ( typeof fakeProfession ( { rank : true } ) , 'string' ) ;
8
+ test ( 'profession with rank return type to be string' , t => {
9
+ t . is ( typeof profession ( { rank : true } ) , 'string' ) ;
10
10
} ) ;
You can’t perform that action at this time.
0 commit comments