Skip to content

Commit

Permalink
Profession 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Jan 9, 2022
1 parent 7982802 commit 6d9b3a2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="2.0.0"></a>
# [2.0.0](https://github.com/faker-javascript/profession) (2022-01-09)

### BREAKING CHANGES

* New function `profession` istead of `fakeProfession`

<a name="1.0.0"></a>
# [1.0.0](https://github.com/faker-javascript/profession) (2022-01-09)
* Initial release
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ $ npm install --save @fakerjs/profession
## Usage

```js
import fakeProfession from '@fakerjs/profession';
import profession from '@fakerjs/profession';

fakeProfession();
profession();
//=> Software Engineer

fakeProfession({rank: true});
profession({rank: true});
//=> Lead Software Engineer

fakeProfession({rank: true, locale: 'en_US'});
profession({rank: true, locale: 'en_US'});
//=> Lead Software Engineer

// Allowed ranks: true, false
// Allowed locales: en_US
// Allowed rank: true, false
// Allowed locale: en_US
```

## Tests
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function fakeProfession(options) {
export default function profession(options) {
options = options || {};
let ranks = {
"en_US": [
Expand Down Expand Up @@ -401,7 +401,7 @@ export default function fakeProfession(options) {
"Warehouse Manager"
]
};
let locale = ((options.locale === undefined) ? 'en_US' : options.locale);
let locale = options.locale || 'en_US';
let randomProfession = professions[locale][Math.floor(Math.random() * professions[locale].length)];
if (options.rank) {
return ranks[locale][Math.floor(Math.random() * ranks[locale].length)] + ' ' + randomProfession;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fakerjs/profession",
"version": "1.0.0",
"version": "2.0.0",
"description": "Profession package provides functionality to generate a fake profession value.",
"license": "MIT",
"repository": "faker-javascript/profession",
Expand All @@ -25,6 +25,7 @@
],
"keywords": [
"fakerjs",
"faker",
"fake",
"random",
"profession",
Expand Down
10 changes: 5 additions & 5 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import fakeProfession from './index.js';
import profession from './index.js';
import test from 'ava';

test('fakeProfession return type to be string', t => {
t.is(typeof fakeProfession(), 'string');
test('profession return type to be string', t => {
t.is(typeof profession(), 'string');
});

test('fakeProfession with rank return type to be string', t => {
t.is(typeof fakeProfession({rank: true}), 'string');
test('profession with rank return type to be string', t => {
t.is(typeof profession({rank: true}), 'string');
});

0 comments on commit 6d9b3a2

Please sign in to comment.