@faykah/first-names-en
An English first names dataset.
Summary
About
Faykah is a Node.js library that help create generators for various data.
This library contains a data set of English first names suited for mocking and testing emails.
Features
- Provides a variable containing 63 first names of men and women
- Provides a browser version
- Provides its own Typescript definition
Installation
Using NPM:
npm install --save-dev @faykah/first-names-en
Using Yarn:
yarn add --dev @faykah/first-names-en
Examples
1. Create an array generator
In this example, we will create a first name generator.
ES6
import { createArrayGenerator } from "@faykah/core";
import { firstNames } from "@faykah/first-names-en";
const generateFirstName = createArrayGenerator(firstNames);
generateFirstName();
generateFirstName();
generateFirstName();
CJS
const { createArrayGenerator } = require("@faykah/core");
const { firstNames } = require("@faykah/first-names-en");
const generateFirstName = createArrayGenerator(firstNames);
generateFirstName();
generateFirstName();
generateFirstName();
Browser
<body>
<script type="text/javascript" src="https://unpkg.com/@faykah/core@0.1.0/lib/index.browser.min.js" defer></script>
<script type="text/javascript" src="https://unpkg.com/@faykah/first-names-en@0.1.0/lib/index.browser.min.js" defer></script>
<script type="text/javascript" defer>
const generateFirstName = Faykah.createArrayGenerator(Faykah.firstNames);
generateFirstName();
generateFirstName();
generateFirstName();
</script>
</body>
2. Standalone usage
In this example, we will loop through the first names to see what is inside.
ES6
import { firstNames } from "@faykah/first-names-en";
for (const firstName of firstNames) {
console.log(firstName);
}
CJS
const { firstNames } = require("@faykah/first-names-en");
for (const firstName of firstNames) {
console.log(firstName);
}
Browser
<body>
<script type="text/javascript" src="https://unpkg.com/@faykah/first-names-en@0.1.0/lib/index.browser.min.js" defer></script>
<script type="text/javascript" defer>
for (const firstName of Faykah.firstNames) {
console.log(firstName);
}
</script>
</body>