Replies: 15 comments 23 replies
-
I personally liked the |
Beta Was this translation helpful? Give feedback.
-
Should we already start to move code into new modules in v6? Or should we start with that in v7? I personally would prefer to wait on v7 with that, so we transition a bit more slowly and have more time to think it right. We can rearrange all the functions later, but at least provide them to be used now. |
Beta Was this translation helpful? Give feedback.
-
As part of #801, a |
Beta Was this translation helpful? Give feedback.
-
I vaguely generated an overview for the actual methods and modules (state of https://github.com/faker-js/faker/tree/d544ef9266fdc4b380ab069435b73b647282b17d) Address
buildingNumber(): string
cardinalDirection(useAbbr: boolean = false): string
city(format?: number | string): string
cityName(): string
cityPrefix(): string
citySuffix(): string
country(): string
countryCode(alphaCode: 'alpha-2' | 'alpha-3' = 'alpha-2'): string
county(): string
direction(useAbbr: boolean = false): string
latitude(max: number = 90, min: number = -90, precision: number = 4): string
longitude(max: number = 180, min: number = -180, precision: number = 4): string
nearbyGPSCoordinate(coordinate?: [number, number], radius?: number = 10, isMetric?: boolean = false): [string, string]
ordinalDirection(useAbbr: boolean = false): string
secondaryAddress(): string
state(): string
stateAbbr(): string
streetAddress(useFullAddress: boolean = false): string
streetName(): string
streetPrefix(): string
streetSuffix(): string
timeZone(): string
zipCode(format?: string): string
zipCodeByState(state: string): string
Animal
bear(): string
bird(): string
cat(): string
cetacean(): string
cow(): string
crocodilia(): string
dog(): string
fish(): string
horse(): string
insect(): string
lion(): string
rabbit(): string
snake(): string
type(): string
Commerce
color(): string
department(): string
price(min: number = 1, max: number = 1000, dec: number = 2, symbol: string = ''): string
product(): string
productAdjective(): string
productDescription(): string
productMaterial(): string
productName(): string
Company
bs(): string
bsAdjective(): string
bsBuzz(): string
bsNoun(): string
catchPhrase(): string
catchPhraseAdjective(): string
catchPhraseDescriptor(): string
catchPhraseNoun(): string
companyName(format?: number): string
companySuffix(): string
suffixes(): string[]
Database
collation(): string
column(): string
engine(): string
mongodbObjectId(): string
type(): string
Datatype
array(length: number = 10): number | string[]
bigInt(value?: bigint | boolean | number | string): bigint
boolean(): boolean
datetime(options?: number | { ... }, options.max?: number, options.min?: number = 633880849813): Date
float(options?: number | { ... }, options.max?: number = 99999, options.min?: number = 0, options.precision?: number = 0.01): number
hexaDecimal(length: number = 1): string
hexadecimal(length: number = 1): string
json(): string
number(options: number | { ... } = 99999, options.max?: number = min + 99999, options.min?: number = 0, options.precision?: number = 1): number
string(length: number = 10): string
uuid(): string
Date
between(from: Date | number | string, to: Date | number | string): Date
betweens(from: Date | number | string, to: Date | number | string, num: number = 3): Date[]
future(years?: number = 1, refDate?: Date | number | string): Date
month(options?: { ... }, options.abbr?: boolean = false, options.context?: boolean = false): string
past(years?: number = 1, refDate?: Date | number | string): Date
recent(days?: number = 1, refDate?: Date | number | string): Date
soon(days?: number = 1, refDate?: Date | number | string): Date
weekday(options?: { ... }, options.abbr?: boolean = false, options.context?: boolean = false): string
Fake
fake(str: string): string
Finance
account(length?: number = 8): string
accountName(): string
amount(min: number = 0, max: number = 1000, dec: number = 2, symbol: string = '', autoFormat?: boolean): string
bic(): string
bitcoinAddress(): string
creditCardCVV(): string
creditCardNumber(provider: string = ''): string
currencyCode(): string
currencyName(): string
currencySymbol(): string
ethereumAddress(): string
iban(formatted: boolean = false, countryCode?: string): string
litecoinAddress(): string
mask(length?: number = 4, parens?: boolean = true, ellipsis?: boolean = true): string
pin(length: number = 4): string
routingNumber(): string
transactionDescription(): string
transactionType(): string
Git
branch(): string
commitEntry(options: { ... } = {}, options.merge?: boolean): string
commitMessage(): string
commitSha(): string
shortSha(): string
Hacker
abbreviation(): string
adjective(): string
ingverb(): string
noun(): string
phrase(): string
verb(): string
Helpers
contextualCard(): ContextualCard
createCard(): Card
createTransaction(): Transaction
mustache(str: string, data: Record<string, (substring: string, args: any[]) => string | string>): string
randomize(<T>: undefined, array: readonly T[] = ['a', 'b', 'c']): T
regexpStyleStringParse(string: string = ''): string
repeatString(string: string = '', num: number = 0): string
replaceCreditCardSymbols(string: string = '6453-####-####-####-###L', symbol: string = '#'): string
replaceSymbolWithNumber(string: string = '', symbol: string = '#'): string
replaceSymbols(string: string = ''): string
shuffle(<T>: undefined, o?: T[] = []): T[]
slugify(string: string = ''): string
uniqueArray(<T>: undefined, source: () => T | readonly T[], length: number): T[]
userCard(): UserCard
Image
abstract(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
animals(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
avatar(): string
business(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
cats(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
city(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
dataUri(width?: number = 640, height?: number = 480, color: string = 'grey'): string
fashion(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
food(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
image(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
imageUrl(width?: number = 640, height?: number = 480, category?: string, randomize?: boolean = false, https?: boolean): string
nature(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
nightlife(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
people(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
sports(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
technics(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
transport(width?: number = 640, height?: number = 480, randomize?: boolean = false): string
Internet
avatar(): string
color(baseRed255: number = 0, baseGreen255: number = 0, baseBlue255: number = 0): string
domainName(): string
domainSuffix(): string
domainWord(): string
email(firstName?: string, lastName?: string, provider?: string, options?: { ... } = { allowSpecialCharacters: false }, options.allowSpecialCharacters?: boolean = false): string
exampleEmail(firstName?: string, lastName?: string, options?: { ... } = { allowSpecialCharacters: false }, options.allowSpecialCharacters?: boolean = false): string
httpMethod(): 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT'
ip(): string
ipv4(): string
ipv6(): string
mac(sep?: string = ':'): string
password(len: number = 15, memorable: boolean = false, pattern: RegExp = /\w/, prefix: string = ''): string
port(): number
protocol(): 'http' | 'https'
url(): string
userAgent(): string
userName(firstName?: string, lastName?: string): string
Lorem
lines(lineCount?: number): string
paragraph(sentenceCount: number = 3): string
paragraphs(paragraphCount: number = 3, separator: string = '\n'): string
sentence(wordCount?: number): string
sentences(sentenceCount?: number, separator: string = ' '): string
slug(wordCount?: number = 3): string
text(): string
word(length?: number): string
words(num: number = 3): string
Mersenne
rand(max: number = 32768, min: number = 0): number
seed(S: number): void
seed_array(A: number[]): void
Music
genre(): string
Name
findName(firstName?: string, lastName?: string, gender?: GenderType): string
firstName(gender?: GenderType): string
gender(binary?: boolean = false): string
jobArea(): string
jobDescriptor(): string
jobTitle(): string
jobType(): string
lastName(gender?: GenderType): string
middleName(gender?: GenderType): string
prefix(gender?: GenderType): string
suffix(): string
title(): string
Phone
phoneFormats(): string
phoneNumber(format?: string = faker.phone.phoneFormats()): string
phoneNumberFormat(phoneFormatsArrayIndex: number = 0): string
Random
alpha(options: number | { ... } = {}, options.bannedChars?: readonly string[] = [], options.count?: number = 1, options.upcase?: boolean = false): string
alphaNumeric(count: number = 1, options: { ... } = {}, options.bannedChars?: readonly string[] = []): string
arrayElement(<T>: undefined, array: readonly T[] = ['a', 'b', 'c']): T
arrayElements(<T>: undefined, array: readonly T[] = ['a', 'b', 'c'], count?: number): T[]
boolean(): boolean
float(options?: number | { ... }, options.max?: number = 99999, options.min?: number = 0, options.precision?: number = 0.01): number
hexaDecimal(count?: number = 1): string
image(): string
locale(): string
number(options?: number | { ... }, options.max?: number = 99999, options.min?: number = 0, options.precision?: number = 1): number
objectElement(<T>: Record<string, unknown>, <K>: number | string | symbol, object: T = { foo: 'bar', too: 'car' }, field?: 'key' | 'value' = 'value'): K | T[K]
uuid(): string
word(): string
words(count?: number): string
System
commonFileExt(): string
commonFileName(ext?: string): string
commonFileType(): string
directoryPath(): string
fileExt(mimeType?: string): string
fileName(): string
filePath(): string
fileType(): string
mimeType(): string
semver(): string
Time
recent(format: 'abbr' | 'date' | 'unix' | 'wide' | string = 'unix'): Date | number | string
Unique
unique(<Method>: (parameters: any[]) => RecordKey, method: Method, args?: Parameters<Method>, options: { ... } = {}, options.currentIterations?: number, options.exclude?: RecordKey | RecordKey[] = [], options.maxRetries?: number = 50, options.maxTime?: number = 50, options.startTime?: number, options.compare?: (obj: Record<RecordKey, RecordKey>, key: RecordKey) => -1 | 0): ReturnType<Method>
Vehicle
bicycle(): string
color(): string
fuel(): string
manufacturer(): string
model(): string
type(): string
vehicle(): string
vin(): string
vrm(): string
Word
adjective(length?: number): string
adverb(length?: number): string
conjunction(length?: number): string
interjection(length?: number): string
noun(length?: number): string
preposition(length?: number): string
verb(length?: number): string |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Yes.
|
Beta Was this translation helpful? Give feedback.
-
Yes.
|
Beta Was this translation helpful? Give feedback.
-
No, lorem generates giberish texts that are distinctly different from the other words. faker.strings generates giberish strings, that aren't intended to be readable. (thats one of the reasons why there is no sentence, paragraph, ... methods in words.) |
Beta Was this translation helpful? Give feedback.
-
Yes |
Beta Was this translation helpful? Give feedback.
-
Maybe move them to |
Beta Was this translation helpful? Give feedback.
-
We should rename our module classes to |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I'd really appreciate being able to use modular imports again. a pain in our migration from the old package to this one was having to update all of our usage. whereas before we could |
Beta Was this translation helpful? Give feedback.
-
please see the following more as a store for my thoughts I listed all current modules with there functions and thought quickly about them old vs new @Shinigami92 - ideas
|
Beta Was this translation helpful? Give feedback.
-
I would like to restructure our modules a bit. This disccussion is a place to different solutions/ways to do this.
datatype
Petition to undeprecate random primitives #607I would like to move
number
/integer
/float
/bigint
to a new module callednumber
.random
moduleI would like to move
alpha
/alphaNumeric
/numeric
/string
to a new module calledstring
.Feel free to suggest other changes or renames.
Beta Was this translation helpful? Give feedback.
All reactions