@faykah/last-names-en
v0.1.0
Published
An English dataset of last names.
Downloads
3
Readme
@faykah/last-names-en
An English dataset of last names.
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 24 last names
- Provides a browser version
- Provides its own Typescript type definition
Installation
Using NPM:
npm install --save-dev @faykah/last-names-en
Using Yarn:
yarn add --dev @faykah/last-names-en
Examples
1. Create an array generator
In this example, we will create a generator of last name.
ES6
import { createArrayGenerator } from "@faykah/core";
import { lastNames } from "@faykah/last-names-en";
const generateLastName = createArrayGenerator(lastNames);
generateLastName(); // "Walsh"
generateLastName(); // "Wilson"
generateLastName(); // "Evans"
CJS
const { createArrayGenerator } = require("@faykah/core");
const { lastNames } = require("@faykah/last-names-en");
const generateLastName = createArrayGenerator(lastNames);
generateLastName(); // "Walsh"
generateLastName(); // "Wilson"
generateLastName(); // "Evans"
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 generateLastName = Faykah.createArrayGenerator(Faykah.lastNames);
generateLastName(); // "Walsh"
generateLastName(); // "Wilson"
generateLastName(); // "Evans"
</script>
</body>
2. Standalone usage
In this example, we will loop through last names.
ES6
import { lastNames } from "@faykah/last-names-en";
for (const lastName of lastNames) {
console.log(lastName);
}
CJS
const { lastNames } = require("@faykah/last-names-en");
for (const lastName of lastNames) {
console.log(lastName);
}
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>
for (const lastName of Faykah.lastNames) {
console.log(lastName);
}
</script>
</body>