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

    name-holder

    1.0.0 • Public • Published

    name-holder

    Generate random names as array or string

    Install

    npm i --save name-holder

    Import

    import nameHolder from "name-holder";
     
    // OR
     
    const nameHolder = require("name-holder");

    name-holder also have some named exports

    import { nickName, petName } from "name-holder";

    Example

    nameHolder(); // "Isabel Andres"

    options

    First parameter is gender (optional)

    • Generate a female name
    nameHolder("f");
    • Generate a string of 2 male names separated by comma (', ')
    nameHolder("m", 2);
    • Generate a string of 2 male names separated by string(' & ')
    nameHolder("m", 2, " & ");
    • Generate a string of 2 random names separated by comma(', ')
    nameHolder(2);
    • Generate a string of 2 random names separated by string(' and ')
    nameHolder(2, " and ");
    • Return a random name in array
    nameHolder([]); // [ "Chaya Mooney" ]
    • Return a female name in array

      First parameter in array is gender (optional)

    nameHolder(["f"]);
    • Return 2 male name in array
    nameHolder(["m", 2]);
    • Return 2 formated male name in array
    nameHolder(["m", 2, (name) => `Hi ${name}`]);
    // [ 'Hi Damion Nina', 'Hi Cohen Choi' ]
    • Return 2 formated random names in array
    nameHolder([2, (name) => `Iam ${name}`]);
    Option object
    nameHolder({ firstNameOnly: true, count: 10 });
    Options list
    • gender "m" | "f" -- Select only specific gender
    • count number -- Number of names
    • separator string -- Separator string
    • asArray boolean -- Return result in array
    • firstNameOnly boolean -- Only return first names
    • format function -- Formater function for each name

    Install

    npm i name-holder

    DownloadsWeekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    93.9 kB

    Total Files

    13

    Last publish

    Collaborators

    • avatar