-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Preyan Bhowmick edited this page Apr 5, 2024
·
2 revisions
rand-name-gen is a simple and lightweight npm package for generating random names.
Install the package with npm:
npm install rand-name-genconst rand = require("rand-name-gen");
console.log(rand.randomName()); // Output: { 'John Doe' }
console.log(rand.randomName({ title: true })); // Output: { 'Mr. John Doe' }
console.log(rand.randomName({ firstName: true })); // Output: { 'John' }
console.log(rand.randomName({ lastName: true })); // Output: { 'Doe' }OR
import { randomName } from "rand-name-gen";
console.log(randomName({ firstName: true, lastName: true })); // Output: { 'John Doe' }
console.log(randomName({ title: true, firstName: true })); // Output: { 'Mr. John' }
console.log(randomName({ title: true, firstName: true, lastName: true })); // Output: { 'Mr. John Doe' }-
randomName()- Returns a random full name without title. -
randomName({ title: true })- Returns a random full name with a title. -
randomName({ firstName: true })- Returns a random first name. -
randomName({ lastName: true })- Returns a random last name. -
randomName({ title: true, firstName: true })- Returns a random first name with a title. -
randomName({ title: true, lastName: true })- Returns a random last name with a title. -
randomName({ firstName: true, lastName: true })- Returns a random first and last name. -
randomName({ title: true, firstName: true, lastName: true })- Returns a random first and last name with a title.
-
title- (Optional) - Boolean value to include a title. -
firstName- (Optional) - Boolean value to include a first name. -
lastName- (Optional) - Boolean value to include a last name.
This project is licensed under the MIT License.