Skip to content

Instantly share code, notes, and snippets.

@FlatMapIO
Last active January 14, 2016 09:58
Show Gist options
  • Save FlatMapIO/82aa1391d11f971465c8 to your computer and use it in GitHub Desktop.
Save FlatMapIO/82aa1391d11f971465c8 to your computer and use it in GitHub Desktop.
faker.js.d.ts
declare module '//cdnjs.cloudflare.com/ajax/libs/Faker/3.0.1/locales/zh_CN/faker.zh_CN.min.js' {
export = Faker;
}
declare namespace Faker {
namespace address {
function zipCode(format?:string);
const __cityFormat = [
'{{address.cityPrefix}} {{name.firstName}} {{address.citySuffix}}',
'{{address.cityPrefix}} {{name.firstName}}',
'{{name.firstName}} {{address.citySuffix}}',
'{{name.lastName}} {{address.citySuffix}}'
];
function city(format?:number);
function cityPrefix();
function citySuffix();
function streetName();
function streetAddress(useFullAddress?:boolean);
function streetSuffix();
function streetPrefix();
function secondaryAddress();
function county();
function country();
function countryCode();
function state(useAbbr?:boolean);
function stateAbbr();
function latitude();
function longitude();
}
namespace commerce {
function color();
function department(max?:number, fixedAmount?:boolean);
function productName();
function price(min:number, max:number, dec:number, symbol:string);
function productAdjective();
function productMaterial();
function product();
}
namespace company {
function suffixes();
const __companyNameFormats = [
'{{name.lastName}} {{company.companySuffix}}',
'{{name.lastName}} - {{name.lastName}}',
'{{name.lastName}}, {{name.lastName}} and {{name.lastName}}'
];
function companyName(format?:number);
function companySuffix();
function catchPhrase();
function bs();
function catchPhraseAdjective();
function catchPhraseDescriptor();
function catchPhraseNoun();
function bsAdjective();
function bsBuzz();
function bsNoun();
}
namespace date {
function past(years?:number, refDate?:Date);
function future(years?:number, refDate?:Date);
function between(from:string, to:string);
function recent(days?:number);
interface DateOption {
abbr?: boolean,
context?: boolean,
}
function month(options?:DateOption);
function weekday(options?:DateOption);
}
function fake(str?:string);
namespace finance {
function account(length?:number);
function accountName();
function mask(length?:number, parens?:boolean, elipsis?:boolean);
function amount(min?:number, max?:number, dec?:number, symbol?:string);
function transactionType();
function currencyCode();
function currencyName();
function currencySymbol();
}
namespace hacker {
function abbreviation();
function adjective();
function noun();
function verb();
function ingverb();
function phrase();
}
namespace helpers {
function randomize(array?:string[]);
function slugify(string?:string);
function replaceSymbolWithNumber(string?:string, symbol?:string);
function replaceSymbols(string?:string);
function shuffle(o?:string[]);
function mustache();
function createCard();
function contextualCard();
function userCard();
function createTransaction();
}
namespace image {
function image();
function avatar();
function imageUrl(width?:number, height?:number, category?:string);
function abstract(width?:number, height?:number);
function animals(width?:number, height?:number);
function business(width?:number, height?:number);
function cats(width?:number, height?:number);
function city(width?:number, height?:number);
function food(width?:number, height?:number);
function nightlife(width?:number, height?:number);
function fashion(width?:number, height?:number);
function people(width?:number, height?:number);
function nature(width?:number, height?:number);
function sports(width?:number, height?:number);
function technics(width?:number, height?:number);
function transport(width?:number, height?:number);
}
namespace internet {
function avatar();
function email(firstName?:string, lastName?:string, provider?:string);
function userName(firstName?:string, lastName?:string);
function protocol();
function url();
function domainName();
function domainSuffix();
function domainWord();
function ip();
function userAgent();
function color(baseRed255?:number, baseGreen255?:number, baseBlue255?:number);
function mac();
function password(len?:number, memorable?:boolean, pattern?:string, prefix?:string);
}
namespace lorem {
function words(num?:number);
function sentence(wordCount?:number, range?:number);
function sentences(sentenceCount?:number);
function paragraph(sentenceCount?:number);
function paragraphs(paragraphCount?:number, separator?:string);
}
namespace name {
function firstName(gender?:number);
function lastName(gender?:number);
function findName(firstName?:string, lastName?:string, gender?:number);
function jobTitle();
function prefix();
function suffix();
function title();
function jobDescriptor();
function jobArea();
function jobType();
}
namespace phone {
function phoneNumber(format?:string);
function phoneNumberFormat(phoneFormatsArrayIndex?:number);
function phoneFormats();
}
namespace random {
interface NumberOptions {
max?: number,
min?:number,
precision?: number,
}
function number(options?:number | NumberOptions);
function arrayElement(array?:string[]);
function objectElement(object?:Object, field?:string);
function uuid();
function boolean();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment