Have ideas to improve npm?Join in the discussion! »

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

    0.1.0 • Public • Published

    @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/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(); // "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/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>

    Install

    npm i @faykah/first-names-en

    DownloadsWeekly Downloads

    20

    Version

    0.1.0

    License

    GPL-3.0

    Unpacked Size

    8.85 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar
    • avatar