mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Update type definitions for "faker" (#38742)
* Update faker.js types * Undo style changes * Undo style changes * Fix random number and float types
This commit is contained in:
parent
0e1c6adfe7
commit
ea511606c9
@ -9,6 +9,7 @@ faker.locale = 'en';
|
||||
|
||||
resultStr = faker.address.zipCode();
|
||||
resultStr = faker.address.zipCode('###');
|
||||
resultStr = faker.address.zipCodeByState('AL');
|
||||
resultStr = faker.address.city();
|
||||
resultStr = faker.address.city(0);
|
||||
resultStr = faker.address.cityPrefix();
|
||||
@ -77,6 +78,7 @@ resultStr = faker.date.weekday({
|
||||
resultStr = faker.finance.account();
|
||||
resultStr = faker.finance.account(0);
|
||||
resultStr = faker.finance.accountName();
|
||||
resultStr = faker.finance.routingNumber();
|
||||
resultStr = faker.finance.mask();
|
||||
resultStr = faker.finance.mask(0, false, false);
|
||||
resultStr = faker.finance.amount();
|
||||
@ -86,11 +88,21 @@ resultStr = faker.finance.currencyCode();
|
||||
resultStr = faker.finance.currencyName();
|
||||
resultStr = faker.finance.currencySymbol();
|
||||
resultStr = faker.finance.bitcoinAddress();
|
||||
resultStr = faker.finance.creditCardNumber();
|
||||
resultStr = faker.finance.creditCardNumber('visa');
|
||||
resultStr = faker.finance.creditCardCVV();
|
||||
resultStr = faker.finance.ethereumAddress();
|
||||
resultStr = faker.finance.iban();
|
||||
resultStr = faker.finance.iban(true);
|
||||
resultStr = faker.finance.bic();
|
||||
|
||||
resultStr = faker.git.branch();
|
||||
resultStr = faker.git.commitEntry();
|
||||
resultStr = faker.git.commitEntry({ merge: true });
|
||||
resultStr = faker.git.commitMessage();
|
||||
resultStr = faker.git.commitSha();
|
||||
resultStr = faker.git.shortSha();
|
||||
|
||||
resultStr = faker.hacker.abbreviation();
|
||||
resultStr = faker.hacker.adjective();
|
||||
resultStr = faker.hacker.noun();
|
||||
@ -104,6 +116,11 @@ resultStr = faker.helpers.randomize(['foo', 'bar', 'quux']);
|
||||
resultStr = faker.helpers.slugify('foo bar quux');
|
||||
resultStr = faker.helpers.replaceSymbolWithNumber('foo# bar#');
|
||||
resultStr = faker.helpers.replaceSymbols('foo# bar? quux#');
|
||||
resultStr = faker.helpers.replaceCreditCardSymbols('6453-####-####-####-###L');
|
||||
resultStr = faker.helpers.replaceCreditCardSymbols('6453-****-****-****-***L', '*');
|
||||
resultStr = faker.helpers.repeatString('a');
|
||||
resultStr = faker.helpers.repeatString('a', 10);
|
||||
resultStr = faker.helpers.regexpStyleStringParse('#{3}test[1-5]');
|
||||
resultStrArr = faker.helpers.shuffle(['foo', 'bar', 'quux']);
|
||||
resultStr = faker.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'});
|
||||
|
||||
@ -160,6 +177,7 @@ resultStr = faker.name.lastName(0);
|
||||
resultStr = faker.name.findName();
|
||||
resultStr = faker.name.findName('', '', 0);
|
||||
resultStr = faker.name.jobTitle();
|
||||
resultStr = faker.name.gender();
|
||||
resultStr = faker.name.prefix();
|
||||
resultStr = faker.name.suffix();
|
||||
resultStr = faker.name.title();
|
||||
@ -180,6 +198,13 @@ resultNum = faker.random.number({
|
||||
max: 0,
|
||||
precision: 0
|
||||
});
|
||||
resultNum = faker.random.float();
|
||||
resultNum = faker.random.float(0.001);
|
||||
resultNum = faker.random.float({
|
||||
min: 0,
|
||||
max: 0,
|
||||
precision: 0.001
|
||||
});
|
||||
resultStr = faker.random.arrayElement();
|
||||
resultStr = faker.random.arrayElement(['foo', 'bar', 'quux']);
|
||||
resultStr = faker.random.objectElement();
|
||||
@ -208,6 +233,14 @@ resultStr = faker.system.directoryPath();
|
||||
resultStr = faker.system.filePath();
|
||||
resultStr = faker.system.semver();
|
||||
|
||||
resultStr = faker.vehicle.vehicle();
|
||||
resultStr = faker.vehicle.manufacturer();
|
||||
resultStr = faker.vehicle.model();
|
||||
resultStr = faker.vehicle.type();
|
||||
resultStr = faker.vehicle.fuel();
|
||||
resultStr = faker.vehicle.vin();
|
||||
resultStr = faker.vehicle.color();
|
||||
|
||||
import fakerAz = require('faker/locale/az');
|
||||
resultStr = fakerAz.name.firstName();
|
||||
import fakerCz = require('faker/locale/cz');
|
||||
|
||||
32
types/faker/index.d.ts
vendored
32
types/faker/index.d.ts
vendored
@ -12,9 +12,10 @@ declare namespace Faker {
|
||||
interface FakerStatic {
|
||||
locale: string;
|
||||
setLocale(locale: string): void;
|
||||
|
||||
|
||||
address: {
|
||||
zipCode(format?: string): string;
|
||||
zipCodeByState(state: string): string;
|
||||
city(format?: number): string;
|
||||
cityPrefix(): string;
|
||||
citySuffix(): string;
|
||||
@ -78,6 +79,7 @@ declare namespace Faker {
|
||||
finance: {
|
||||
account(length?: number): string;
|
||||
accountName(): string;
|
||||
routingNumber(): string;
|
||||
mask(length?: number, parens?: boolean, elipsis?: boolean): string;
|
||||
amount(min?: number, max?: number, dec?: number, symbol?: string): string;
|
||||
transactionType(): string;
|
||||
@ -85,11 +87,21 @@ declare namespace Faker {
|
||||
currencyName(): string;
|
||||
currencySymbol(): string;
|
||||
bitcoinAddress(): string;
|
||||
creditCardNumber(provider?: string): string;
|
||||
creditCardCVV(): string;
|
||||
ethereumAddress(): string;
|
||||
iban(formatted?: boolean): string
|
||||
bic(): string
|
||||
};
|
||||
|
||||
git: {
|
||||
branch(): string;
|
||||
commitEntry(options?: { merge: boolean }): string;
|
||||
commitMessage(): string;
|
||||
commitSha(): string;
|
||||
shortSha(): string;
|
||||
}
|
||||
|
||||
hacker: {
|
||||
abbreviation(): string;
|
||||
adjective(): string;
|
||||
@ -105,6 +117,9 @@ declare namespace Faker {
|
||||
slugify(string?: string): string;
|
||||
replaceSymbolWithNumber(string?: string, symbol?: string): string;
|
||||
replaceSymbols(string?: string): string;
|
||||
replaceCreditCardSymbols(string: string, symbol?: string): string;
|
||||
repeatString(string: string, num?: number): string;
|
||||
regexpStyleStringParse(string: string): string;
|
||||
shuffle<T>(o: T[]): T[];
|
||||
shuffle(): string[];
|
||||
mustache(str: string, data: { [key: string]: string|((substring: string, ...args: any[]) => string) }): string;
|
||||
@ -169,6 +184,7 @@ declare namespace Faker {
|
||||
lastName(gender?: number): string;
|
||||
findName(firstName?: string, lastName?: string, gender?: number): string;
|
||||
jobTitle(): string;
|
||||
gender(): string;
|
||||
prefix(): string;
|
||||
suffix(): string;
|
||||
title(): string;
|
||||
@ -184,8 +200,10 @@ declare namespace Faker {
|
||||
};
|
||||
|
||||
random: {
|
||||
number(max: number): number;
|
||||
number(max?: number): number;
|
||||
number(options?: { min?: number, max?: number, precision?: number }): number;
|
||||
float(precision?: number): number;
|
||||
float(options?: { min?: number, max?: number, precision?: number }): number;
|
||||
arrayElement(): string;
|
||||
arrayElement<T>(array: T[]): T;
|
||||
objectElement(object?: { [key: string]: any }, field?: "key"): string;
|
||||
@ -214,6 +232,16 @@ declare namespace Faker {
|
||||
};
|
||||
|
||||
seed(value: number): void;
|
||||
|
||||
vehicle: {
|
||||
vehicle(): string;
|
||||
manufacturer(): string;
|
||||
model(): string;
|
||||
type(): string;
|
||||
fuel(): string;
|
||||
vin(): string;
|
||||
color(): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface Card {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user