FakeDataJS - Fake Age
Install
$ npm install -D @fakedatajs/fake-age
Usage
import { fakeAge } from '@fakedatajs/fake-age'
fakeAge() // => a number from 0 to 120
fakeAge({ type: 'baby' }) // => a number between 0 and 2
fakeAge({ type: 'child' }) // => a number between 2 and 10
fakeAge({ type: 'teen' }) // => a number between 10 and 18
fakeAge({ type: 'adult' }) // => a number between 18 and 65
fakeAge({ type: 'old' }) // => a number between 65 and 120
Options
type AgeOptions = {
type: LifePhases
}
type LifePhases = 'baby' | 'child' | 'teen' | 'adult' | 'old'
Tests
npm run test