@faykah/last-names-en
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

@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/core@0.1.0/lib/index.browser.min.js" defer></script>
	<script type="text/javascript" src="https://unpkg.com/@faykah/last-names-en@0.1.0/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/core@0.1.0/lib/index.browser.min.js" defer></script>
	<script type="text/javascript" src="https://unpkg.com/@faykah/last-names-en@0.1.0/lib/index.browser.min.js" defer></script>

	<script type="text/javascript" defer>
		for (const lastName of Faykah.lastNames) {
			console.log(lastName);
		}
	</script>
</body>

Package Sidebar

Install

npm i @faykah/last-names-en

Weekly Downloads

1

Version

0.1.0

License

GPL-3.0

Unpacked Size

6.52 kB

Total Files

8

Last publish

Collaborators

  • aminnairi
  • khalyomede