An English dataset of person titles.
Faykah is a Node.js library that help create generators for various data.
This library contains a data set of English person titles (like Mr, Mrs, ...) suited for mocking and testing emails.
- Provides a list of 5 person titles
- Provides a browser version
- Provides its own Typescript type definition
Using NPM:
npm install --save-dev @faykah/person-titles-en
Using Yarn:
yarn add --dev @faykah/person-titles-en
In this example, we will create a person title generator.
ES6
import { createGenerator } from "@faykah/core";
import { personTitles } from "@faykah/person-titles-en";
const generatePersonTitle = createGenerator(personTitles);
generatePersonTitle(); // "Mrs"
generatePersonTitle(); // "Dr"
generatePersonTitle(); // "Mr"
CJS
const { createGenerator } = require("@faykah/core");
const { personTitles } = require("@faykah/person-titles-en");
const generatePersonTitle = createGenerator(personTitles);
generatePersonTitle(); // "Mrs"
generatePersonTitle(); // "Dr"
generatePersonTitle(); // "Mr"
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 { createGenerator } = Faykah;
const { personTitles } = Faykah.personTitles;
const generateTitle = createGenerator(personTitles);
console.log(generateTitle());
console.log(generateTitle());
console.log(generateTitle());
</script>
</body>
In this example, we will loop through all the person titles.
ES6
import { personTitles } from "@faykah/person-titles-en";
for (const personTitle of personTitles) {
console.log(personTitle);
}
CJS
const { personTitles } = require("@faykah/person-titles-en");
for (const personTitle of personTitles) {
console.log(personTitle);
}
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 { personTitles } = Faykah.personTitles;
for (const personTitle of personTitles) {
console.log(personTitle);
}
</script>
</body>