Gathering detailed insights and metrics for faker-en
Gathering detailed insights and metrics for faker-en
A much smaller version of faker-js that only supports english and also exports each generator individually so the entire package doesn't need to be bundled with projects
npm install faker-en
Typescript
Module System
Node Version
NPM Version
76.5
Supply Chain
99.1
Quality
75.9
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
1,395
Last Day
1
Last Week
6
Last Month
21
Last Year
195
13 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
2.5.1
Package Id
faker-en@2.5.1
Unpacked Size
85.52 kB
Size
21.69 kB
File Count
44
NPM Version
9.2.0
Node Version
19.4.0
Publised On
20 Jan 2023
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-50%
6
Compared to previous week
Last month
90.9%
21
Compared to previous month
Last year
-50.1%
195
Compared to previous year
1
This is a much smaller version of faker-js that is meant to only support english mock-data generation.
Each method can be imported on its own so that the impact to your project's bundle is limited.
This is still a work in progress so many of the features from faker-js
are still missing.
faker-en is a package that generates usable random data in English. It exports the following methods:
person
This submodule contains methods for generating random data related to people. To use these methods, you can import them like this:
1import { firstName, fullName, lastName, phoneNumber } from "faker-en/person"; 2 3const groom = { 4 firstName: firstName("male"), 5 lastName: lastName(), 6 phoneNumber: phoneNumber(), 7}; 8 9const bride = { 10 firstName: firstName("female"), 11 lastName: lastName(), 12 phoneNumber: phoneNumber(), 13};
firstName
1import { firstName } from "faker-en/person/firstName";
gender?: Gender
- optional, either 'male' or 'female'. Random by default.
Generates a random first name for a person.
fullName
1import { fullName } from "faker-en/person/fullName";
gender?: Gender
- optional, either 'male' or 'female'. Random by default.
Generates a random full name for a person, including a first name and last name.
lastName
1import { lastName } from "faker-en/person/lastName";
This function accepts no parameters
Generates a random last name for a person.
phoneNumber
1import { phoneNumber } from "faker-en/person/phoneNumber";
props?: PhoneNumberProps
- optional, an object containing the following properties:
props.areaCode?: string
- optional, a string containing the area code for the phone number. Random by default.props.format?: PhoneFormat
- optional, a string containing the format for the phone number. The options are "standard" | "business" | "international" | "plain"
"standard"
: 212-555-5555
"business"
: (212) 555-5555
"international"
: +1 212-555-5555
"plain"
: 2125555555
Generates a random phone number for a person.
utils
This submodule contains utility methods that are used by other methods in faker-en. To use these methods, you can import them like this:
1import { 2 arrayElement, 3 arrayElements, 4 gender, 5 randomNumber, 6 shuffle, 7} from "faker-en/utils";
arrayElement
1import { arrayElement } from "faker-en/utils/arrayElement";
array
- an array of any typeReturns a random element from an array.
arrayElements
1import { arrayElements } from "faker-en/utils/arrayElements";
array
- an array of any typecount
- the number of elements to return. (min: 0
, max: array.length
)
Returns a specified number of random elements from an array.Returns a specified number of random elements from an array.
gender
1import { gender } from "faker-en/utils/gender";
exact?: Gender
: "male"
or "female"
. If this is provided then the function will return this valueReturns a random gender (either "male" or "female").
randomNumber
1import { randomNumber } from "faker-en/utils/randomNumber";
opts: RandomNumberProps
- an object with the following properties. Required.
opts.min: number
- the minimum value for the random number. Optional. Defaults to 0.opts.max: number
- the maximum value for the random number. Required.Generates a random number within a specified range.
shuffle
1import { shuffle } from "faker-en/utils/shuffle";
array: any[]
- An array of any typeRandomly shuffles the order of elements of an array.
word
This submodule contains methods for generating random words:
1import { word, noun, verb } from "faker-en/word"; 2 3const randomWord = word(); 4const item = noun(); 5const action = verb();
noun
1import { noun } from "faker-en/word/noun";
This function accepts no parameters
Generates a random noun
verb
1import { verb } from "faker-en/word/verb";
This function accepts no parameters
Generates a random verb.
No vulnerabilities found.
No security vulnerabilities found.