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()
This project is licensed under the MIT License.
