From ad1fc071072e57e8b5a6720ec39e753317f31149 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 9 Jan 2022 19:25:30 +0300 Subject: [PATCH] Age 2.0.0 --- CHANGELOG.md | 7 +++++++ README.md | 6 +++--- index.js | 2 +- package.json | 3 ++- test.js | 36 ++++++++++++++++++------------------ 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4bffb0..075f33d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ + +# [2.0.0](https://github.com/faker-javascript/age) (2022-01-09) + +### BREAKING CHANGES + +* New function `age` istead of `fakeAge` + # [1.0.0](https://github.com/faker-javascript/age) (2022-01-08) * Initial release diff --git a/README.md b/README.md index 7639391..18a6f68 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ $ npm install --save @fakerjs/age ## Usage ```js -import fakeAge from '@fakerjs/age'; +import age from '@fakerjs/age'; -fakeAge(); +age(); //=> 42 -fakeAge({type: 'child'}); +age({type: 'child'}); //=> 10 // Allowed type: child, teen, adult, senior diff --git a/index.js b/index.js index 2cde5d1..bccf470 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -export default function fakeAge(options) { +export default function age(options) { options = options || {}; let min = 0; let max = 100; diff --git a/package.json b/package.json index 0eeb20b..16f5189 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fakerjs/age", - "version": "1.0.0", + "version": "2.0.0", "description": "Age package provides functionality to generate a fake age value.", "license": "MIT", "repository": "faker-javascript/age", @@ -25,6 +25,7 @@ ], "keywords": [ "fakerjs", + "faker", "fake", "random", "age" diff --git a/test.js b/test.js index 9758c3a..66890e1 100644 --- a/test.js +++ b/test.js @@ -1,31 +1,31 @@ -import fakeAge from './index.js'; +import age from './index.js'; import test from 'ava'; -test('fakeAge return type to be number', t => { - t.is(typeof fakeAge(), 'number'); +test('age return type to be number', t => { + t.is(typeof age(), 'number'); }); -test('fakeAge with type child less than 13 and more than -1', t => { - t.true(fakeAge({type: 'child'}) < 13); - t.true(fakeAge({type: 'child'}) > -1); +test('age with type child less than 13 and more than -1', t => { + t.true(age({type: 'child'}) < 13); + t.true(age({type: 'child'}) > -1); }); -test('fakeAge with type teen less than 20 and more than 12', t => { - t.true(fakeAge({type: 'teen'}) < 20); - t.true(fakeAge({type: 'teen'}) > 12); +test('age with type teen less than 20 and more than 12', t => { + t.true(age({type: 'teen'}) < 20); + t.true(age({type: 'teen'}) > 12); }); -test('fakeAge with type adult less than 69 and more than 17', t => { - t.true(fakeAge({type: 'adult'}) < 69); - t.true(fakeAge({type: 'adult'}) > 17); +test('age with type adult less than 69 and more than 17', t => { + t.true(age({type: 'adult'}) < 69); + t.true(age({type: 'adult'}) > 17); }); -test('fakeAge with type senior less than 101 and more than 64', t => { - t.true(fakeAge({type: 'senior'}) < 101); - t.true(fakeAge({type: 'senior'}) > 64); +test('age with type senior less than 101 and more than 64', t => { + t.true(age({type: 'senior'}) < 101); + t.true(age({type: 'senior'}) > 64); }); -test('fakeAge with type all less than 101 and more than -1', t => { - t.true(fakeAge({type: 'all'}) < 101); - t.true(fakeAge({type: 'all'}) > -1); +test('age with type all less than 101 and more than -1', t => { + t.true(age({type: 'all'}) < 101); + t.true(age({type: 'all'}) > -1); }); \ No newline at end of file