1.0.2 • Published 2 years ago

@dadolyner/faker v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Package that generate fake data

Description

This package create fake data for testing and it is fully async.

Usage

import DadoFaker from "@dadolyner/faker";

const Faker = new DadoFaker()
const generateUser = async () => {
    const user = await Faker.CreateUser()
    console.log(user)
}
generateUser()

Functions

FunctionDescriptionParametersReturn
firstName()generates a random first namestring
lastName()generates a random last namestring
address()generates a random addressstring
countries()generates a random countrystring
uuid()generates a uuid based on version(3-5)version: integerstring
email(first_name?: string, last_name?: string)generates a random email or combined first and lastnamefirst_name: string, last_name: stringstring
password(length: number)generates a random password of provided lengthlength: numberstring
birthDate()generates a random birth datestring
phoneNumber(format: string)generates a random phone number of provided format "(xxx)-xxxx" -> x will be replaced with a numberformat: stringstring
token(length: number, minutes: number)generates a random token of provided length and expiration length in minuteslength: number, minutes: number{ token: string, tokenExpiryDate: string }
coordinations()generates a random coordination{ lat: number, lng: number }
quote()generates a random quote{ quote: string, author: string }
image(isAvatar: boolean, filter?: string)generates a random image of provided filter and if is avatar will return random profile imageisAvatar: boolean, filter: stringstring
rand(min: number, max: number)generates a random number between min and maxmin: number, max: numbernumber
color()generates a random colorstring

Premade functions

FunctionDescriptionParametersReturn
CreateUser()creates a user object{ firstName: string, lastName: string, email: string, password: string, birthDate: string, phoneNumber: string, address: string, country: string, uuid: string }
CreateLocation()creates a location object{ id: string, place: string, country: string, coordinates: { lat: number, lng: number }, latitude: number, longitude: number }
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago