npm i modnarjs
const modnarjs = require("modnarjs");
// or
import modnarjs from "modnarjs";
you can change default array of first & last name. only if you need to change default config!
modnarjs.name.config(data: {
F_NAME?: string[]; // female names
M_NAME?: string[]; // male names
LAST_NAME?: string[]; // last names
}): void
// e.g.
name.config({ LAST_NAME: ["bashi", "espinal", "blackwall"] })
Random male or female first name
modnarjs.name.fName(data?: {
name?: string;
gender?: string;
start?: string;
end?: string;
}): string
// e.g.
modnarjs.name.fName() // "sam"
Random last name
modnarjs.name.lName(data?: {
name?: string,
start?: string,
end?: string
}): string
// e.g.
modnarjs.name.lName({start: "h"}) // "haggstrom"
Random prefix
modnarjs.name.prefix(
gender?: string
): string
// e.g.
modnarjs.name.prefix("male") // "Mr."
Random day
modnarjs.date.day(): string
// e.g.
modnarjs.date.day() // "Monday"
Random month
modnarjs.date.month(): string
// e.g.
modnarjs.date.month() // "February"
Random animal kind
modnarjs.animal.kind(): string
// e.g.
modnarjs.animal.kind() // "dog"
Random colors (rgb,rgba,hex) - formats (default is "rgb")
modnarjs.color.color(format?: string): number[] | undefined | string
// e.g.
modnarjs.color.color('hex') // "1e1e1e"
Random phone number with your own format
modnarjs.phone.phone(format?: string): string
// e.g.
modnarjs.phone.phone("### ### - ###") // "123 645 - 123"
modnarjs.phone.phone() // "+1 645 123 4343"
you can change config for default 'sentences per paragraph' and 'words per sentence'
modnarjs.lorem.config(data: {
WPS?: { // words per sentence
min?: number; // default is 4
max?: number; // default is 16
};
SPP?: { // sentences per paragraph
min?: number; // default is 4
max?: number; // default is 8
}
}): void
Random sentence, you can change default words per sentence
modnarjs.lorem.sentences(sentences: number): string
// e.g.
modnarjs.lorem.sentences(1) // "relaxing delphi trophy emotion buick."
Random paragraph, you can change default sentences per paragraph
modnarjs.lorem.paragraphs(paragraphs: number): string
// e.g.
modnarjs.lorem.paragraphs(5)
All credit card numbers are valid with luhn algorithm
Random visa card info
modnarjs.card.visaCard(): I_Card_Visa
// e.g.
modnarjs.card.visaCard()
/*
{
name: "Visa",
creditNumber: 4775876705860201,
cvv: 712,
holder: 'WENDELL CMIEL',
expire: '15/24'
}
*/
Random master card info
modnarjs.card.masterCard(): I_Card_Visa
Random amex card info
modnarjs.card.amexCard(): I_Card_Visa
modnarjs.card.isValid(creaditCardNumber: string): I_Card_Visa_Valid
// e.g.
modnarjs.card.isValid("4775876705860201")
/*
{
isValid: true,
checksum: undefined
}
*/
Random email
modnarjs.net.email(data?: {
firstName?: string,
lastName?: string,
company?: string, // e.g. "gmail.com"
}): string
// e.g.
modnarjs.net.email() // "[email protected]"
Random ipv4 - Class types "A","B","C","D","E"
modnarjs.net.ipv4(classType?: string): string
// e.g.
modnarjs.net.ipv4("A") // "42.29.140.187"
modnarjs.net.ipv4() // "164.198.12.127"
Random top-level domain with 1487 top-level domains
modnarjs.net.domain(): string
// e.g.
modnarjs.net.domain() // "com"
Random country name
modnarjs.country.country(): string
// e.g.
modnarjs.country.country() // "Egypt"
Random float number
modnarjs.number.float(data?: {
min?: number;
max?: number;
decimal?: number;
}): number
// e.g.
modnarjs.number.float({ min: 1, max: 1000 }) // 206.77
Random int number
modnarjs.number.int(data?: {
min?: number;
max?: number;
}): number
// e.g.
modnarjs.number.int() // 10
Random int or float array number, type and length can not be undefined.
modnarjs.number.array(data: {
min?: number;
max?: number;
decimal?: number;
type: string; // "int" or "float"
length: number;
}): number[]
// e.g.
modnarjs.number.array({length:5,type:'int'}) // [ 606, 218, 787, 480, 340 ]