@faykah/first-names-en
v0.1.0
Published
An English first names dataset.
Downloads
4
Readme
@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(); // "Oscar"
generateFirstName(); // "Isabella"
generateFirstName(); // "Samantha"
CJS
const { createArrayGenerator } = require("@faykah/core");
const { firstNames } = require("@faykah/first-names-en");
const generateFirstName = createArrayGenerator(firstNames);
generateFirstName(); // "Oscar"
generateFirstName(); // "Isabella"
generateFirstName(); // "Samantha"
Browser
<body>
<script type="text/javascript" src="https://unpkg.com/@faykah/[email protected]/lib/index.browser.min.js" defer></script>
<script type="text/javascript" src="https://unpkg.com/@faykah/[email protected]/lib/index.browser.min.js" defer></script>
<script type="text/javascript" defer>
const generateFirstName = Faykah.createArrayGenerator(Faykah.firstNames);
generateFirstName(); // "Oscar"
generateFirstName(); // "Isabella"
generateFirstName(); // "Samantha"
</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/[email protected]/lib/index.browser.min.js" defer></script>
<script type="text/javascript" defer>
for (const firstName of Faykah.firstNames) {
console.log(firstName);
}
</script>
</body>