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+
18<a name =" 1.0.0 " ></a >
29# [ 1.0.0] ( https://github.com/faker-javascript/profession ) (2022-01-09)
310* Initial release
Original file line number Diff line number Diff line change @@ -15,19 +15,19 @@ $ npm install --save @fakerjs/profession
1515## Usage
1616
1717``` js
18- import fakeProfession from ' @fakerjs/profession' ;
18+ import profession from ' @fakerjs/profession' ;
1919
20- fakeProfession ();
20+ profession ();
2121// => Software Engineer
2222
23- fakeProfession ({rank: true });
23+ profession ({rank: true });
2424// => Lead Software Engineer
2525
26- fakeProfession ({rank: true , locale: ' en_US' });
26+ profession ({rank: true , locale: ' en_US' });
2727// => Lead Software Engineer
2828
29- // Allowed ranks : true, false
30- // Allowed locales : en_US
29+ // Allowed rank : true, false
30+ // Allowed locale : en_US
3131```
3232
3333## Tests
Original file line number Diff line number Diff line change 1- export default function fakeProfession ( options ) {
1+ export default function profession ( options ) {
22 options = options || { } ;
33 let ranks = {
44 "en_US" : [
@@ -401,7 +401,7 @@ export default function fakeProfession(options) {
401401 "Warehouse Manager"
402402 ]
403403 } ;
404- let locale = ( ( options . locale === undefined ) ? 'en_US' : options . locale ) ;
404+ let locale = options . locale || 'en_US' ;
405405 let randomProfession = professions [ locale ] [ Math . floor ( Math . random ( ) * professions [ locale ] . length ) ] ;
406406 if ( options . rank ) {
407407 return ranks [ locale ] [ Math . floor ( Math . random ( ) * ranks [ locale ] . length ) ] + ' ' + randomProfession ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @fakerjs/profession" ,
3- "version" : " 1 .0.0" ,
3+ "version" : " 2 .0.0" ,
44 "description" : " Profession package provides functionality to generate a fake profession value." ,
55 "license" : " MIT" ,
66 "repository" : " faker-javascript/profession" ,
2525 ],
2626 "keywords" : [
2727 " fakerjs" ,
28+ " faker" ,
2829 " fake" ,
2930 " random" ,
3031 " profession" ,
Original file line number Diff line number Diff line change 1- import fakeProfession from './index.js' ;
1+ import profession from './index.js' ;
22import test from 'ava' ;
33
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' ) ;
66} ) ;
77
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' ) ;
1010} ) ;
You can’t perform that action at this time.
0 commit comments