Skip to content

Instantly share code, notes, and snippets.

@FlatMapIO
Last active January 14, 2016 09:58
Show Gist options
  • Select an option

  • Save FlatMapIO/82aa1391d11f971465c8 to your computer and use it in GitHub Desktop.

Select an option

Save FlatMapIO/82aa1391d11f971465c8 to your computer and use it in GitHub Desktop.

Revisions

  1. FlatMapIO revised this gist Jan 14, 2016. 1 changed file with 39 additions and 38 deletions.
    77 changes: 39 additions & 38 deletions faker.d.ts
    Original file line number Diff line number Diff line change
    @@ -6,23 +6,24 @@ declare namespace Faker {

    namespace address {

    function zipCode(format?: string);
    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 city(format?:number);

    function cityPrefix();

    function citySuffix();

    function streetName();

    function streetAddress(useFullAddress?: boolean);
    function streetAddress(useFullAddress?:boolean);

    function streetSuffix();

    @@ -37,7 +38,7 @@ declare namespace Faker {
    function countryCode();


    function state(useAbbr?: boolean);
    function state(useAbbr?:boolean);

    function stateAbbr();

    @@ -49,11 +50,11 @@ declare namespace Faker {
    namespace commerce {
    function color();

    function department(max?: number, fixedAmount?: boolean);
    function department(max?:number, fixedAmount?:boolean);

    function productName();

    function price(min: number, max: number, dec: number, symbol: string);
    function price(min:number, max:number, dec:number, symbol:string);

    function productAdjective();

    @@ -70,7 +71,7 @@ declare namespace Faker {
    '{{name.lastName}}, {{name.lastName}} and {{name.lastName}}'
    ];

    function companyName(format?: number);
    function companyName(format?:number);

    function companySuffix();

    @@ -92,34 +93,34 @@ declare namespace Faker {
    }

    namespace date {
    function past(years?: number, refDate?: Date);
    function past(years?:number, refDate?:Date);

    function future(years?: number, refDate?: Date);
    function future(years?:number, refDate?:Date);

    function between(from: string, to: string);
    function between(from:string, to:string);

    function recent(days?: number);
    function recent(days?:number);

    interface DateOption {
    abbr?: boolean,
    context?: boolean,
    }

    function month(options?: DateOption);
    function month(options?:DateOption);

    function weekday(options?: DateOption);
    function weekday(options?:DateOption);
    }

    function fake(str?: string);
    function fake(str?:string);

    namespace finance {
    function account(length?: number);
    function account(length?:number);

    function accountName();

    function mask(length?: number, parens?: boolean, elipsis?:boolean);
    function mask(length?:number, parens?:boolean, elipsis?:boolean);

    function amount(min?: number, max?: number, dec?: number, symbol?: string);
    function amount(min?:number, max?:number, dec?:number, symbol?:string);

    function transactionType();

    @@ -145,15 +146,15 @@ declare namespace Faker {
    }

    namespace helpers {
    function randomize(array?: string[]);
    function randomize(array?:string[]);

    function slugify(string?: string);
    function slugify(string?:string);

    function replaceSymbolWithNumber(string?: string, symbol?: string);
    function replaceSymbolWithNumber(string?:string, symbol?:string);

    function replaceSymbols(string?: string);
    function replaceSymbols(string?:string);

    function shuffle(o?: string[]);
    function shuffle(o?:string[]);

    function mustache();

    @@ -171,7 +172,7 @@ declare namespace Faker {

    function avatar();

    function imageUrl(width?:number, height?:number, category?: string);
    function imageUrl(width?:number, height?:number, category?:string);

    function abstract(width?:number, height?:number);

    @@ -203,9 +204,9 @@ declare namespace Faker {
    namespace internet {
    function avatar();

    function email(firstName?: string, lastName?: string, provider?: string);
    function email(firstName?:string, lastName?:string, provider?:string);

    function userName(firstName?: string, lastName?: string);
    function userName(firstName?:string, lastName?:string);

    function protocol();

    @@ -221,31 +222,31 @@ declare namespace Faker {

    function userAgent();

    function color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number);
    function color(baseRed255?:number, baseGreen255?:number, baseBlue255?:number);

    function mac();

    function password(len?: number, memorable?: boolean, pattern?: string, prefix?: string);
    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 sentences(sentenceCount?:number);

    function paragraph(sentenceCount?: number);
    function paragraph(sentenceCount?:number);

    function paragraphs(paragraphCount?: number, separator?:string);
    function paragraphs(paragraphCount?:number, separator?:string);
    }

    namespace name {
    function firstName(gender?: number);
    function firstName(gender?:number);

    function lastName(gender?: number);
    function lastName(gender?:number);

    function findName(firstName?: string, lastName?:string, gender?:number);
    function findName(firstName?:string, lastName?:string, gender?:number);

    function jobTitle();

    @@ -263,9 +264,9 @@ declare namespace Faker {
    }

    namespace phone {
    function phoneNumber(format?: string);
    function phoneNumber(format?:string);

    function phoneNumberFormat(phoneFormatsArrayIndex?: number);
    function phoneNumberFormat(phoneFormatsArrayIndex?:number);

    function phoneFormats();
    }
    @@ -276,11 +277,11 @@ declare namespace Faker {
    min?:number,
    precision?: number,
    }
    function number(options?: number | NumberOptions);
    function number(options?:number | NumberOptions);

    function arrayElement(array?: string[]);
    function arrayElement(array?:string[]);

    function objectElement(object?: Object, field?:string);
    function objectElement(object?:Object, field?:string);

    function uuid();

  2. FlatMapIO revised this gist Jan 14, 2016. 1 changed file with 7 additions and 15 deletions.
    22 changes: 7 additions & 15 deletions faker.d.ts
    Original file line number Diff line number Diff line change
    @@ -8,20 +8,12 @@ declare namespace Faker {

    function zipCode(format?: string);

    enum CityFormat {
    address_cityPrefix__name_firstName__address_citySuffix,
    address_cityPrefix__name_firstName,
    name_firstNameaddress_citySuffix,
    name_lastName__address_citySuffix
    }
    /**
    *
    * | '{{address.cityPrefix}} {{name.firstName}} {{address.citySuffix}}',
    * | '{{address.cityPrefix}} {{name.firstName}}',
    * | '{{name.firstName}} {{address.citySuffix}}',
    * | '{{name.lastName}} {{address.citySuffix}}'
    * @param format
    */
    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();
    @@ -72,7 +64,7 @@ declare namespace Faker {
    namespace company {
    function suffixes();

    const __companyNameFormts = [
    const __companyNameFormats = [
    '{{name.lastName}} {{company.companySuffix}}',
    '{{name.lastName}} - {{name.lastName}}',
    '{{name.lastName}}, {{name.lastName}} and {{name.lastName}}'
  3. FlatMapIO created this gist Jan 14, 2016.
    297 changes: 297 additions & 0 deletions faker.d.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,297 @@
    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);

    enum CityFormat {
    address_cityPrefix__name_firstName__address_citySuffix,
    address_cityPrefix__name_firstName,
    name_firstNameaddress_citySuffix,
    name_lastName__address_citySuffix
    }
    /**
    *
    * | '{{address.cityPrefix}} {{name.firstName}} {{address.citySuffix}}',
    * | '{{address.cityPrefix}} {{name.firstName}}',
    * | '{{name.firstName}} {{address.citySuffix}}',
    * | '{{name.lastName}} {{address.citySuffix}}'
    * @param format
    */
    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 __companyNameFormts = [
    '{{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();
    }
    }