Generate random name for your project.
npm i --save name-holder
import nameHolder from "name-holder";
// OR
const nameHolder = require("name-holder");
name-holder
also have some named exports
import { nickName, petName } from "name-holder";
nameHolder(); // "Isabel Andres"
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}`]);
nameHolder({ firstNameOnly: true, count: 10 });
- 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