UNPKG

4.94 kBTypeScriptView Raw
1declare module "casual" {
2
3
4 interface casual {
5 define(type: string, cb: () => any): void;
6 country: string; // 'United Kingdom'
7 city: string; // 'New Ortiz chester'
8 zip(digits: Object): string; // '26995-7979' (if no digits specified then random selection between ZIP and ZIP+4)
9 street: string; // 'Jadyn Islands'
10 address: string; // '6390 Tremblay Pines Suite 784'
11 address1: string; // '8417 Veda Circles'
12 address2: string; // 'Suite 648'
13 state: string; // 'Michigan'
14 state_abbr: string; // 'CO'
15 latitude: string; // 90.0610
16 longitude: string; // 180.0778
17 building_number: string; // 2413
18
19 // Text
20
21 sentence: string; // 'Laborum eius porro consequatur.'
22 sentences(n?: number): string; // 'Dolorum fuga nobis sit natus consequatur. Laboriosam sapiente. Natus quos ut.'
23 title: string; // 'Systematic nobis'
24 text: string; // 'Nemo tempore natus non accusamus eos placeat nesciunt. et fugit ut odio nisi dolore non ... (long text)'
25 description: string; // 'Vel et rerum nostrum quia. Dolorum fuga nobis sit natus consequatur.'
26 short_description: string; // 'Qui iste similique iusto.'
27 string: string; // 'saepe quia molestias voluptates et'
28 word: string; // 'voluptatem'
29 words(n?: number): string; // 'sed quis ut beatae id adipisci aut'
30 array_of_words(n?: number): Array<string>; // [ 'voluptas', 'atque', 'vitae', 'vel', 'dolor', 'saepe', 'ut' ]
31 letter: string; // 'k'
32
33 // Internet
34
35 ip: string; // '21.44.122.149'
36 domain: string; // 'darrion.us'
37 url: string; // 'germaine.net'
38 email: string; // 'Josue.Hessel@claire.us'
39 user_agent: string; // 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0'
40
41 // Person
42
43 name: string; // 'Alberto'
44 username: string; // 'Darryl'
45 first_name: string; // 'Derek'
46 last_name: string; // 'Considine'
47 full_name: string; // 'Kadin Torphy'
48 password: string; // '(205)580-1350Schumm'
49 name_prefix: string; // 'Miss'
50 name_suffix: string; // 'Jr.'
51 company_name: string; // 'Cole, Wuckert and Strosin'
52 company_suffix: string; // 'Inc'
53 catch_phrase: string; // 'Synchronised optimal concept'
54 phone: string; // '982-790-2592'
55
56 // numbers
57
58 random // 0.7171590146608651 (core generator)
59 integer(from?: number, to?: number): number // 632
60 double(from?: number, to?: number): number // -234.12987444
61 array_of_digits(n?: number): Array<number>; // [ 4, 8, 3, 1, 7, 6, 6 ]
62 array_of_integers(n?: number): Array<number>; // [ -105, -7, -532, -596, -430, -957, -234 ]
63 array_of_doubles(n?: number): Array<number>; // [ -866.3755785673857, -166.62194719538093, ...]
64 coin_flip: Boolean; // true
65
66 // Date
67
68 unix_time: number; // 659897901
69 moment: any; // moment.js object see http://momentjs.com/docs/
70 date(format?: string): string; // '2001-07-06' (see available formatters http://momentjs.com/docs/#/parsing/string-format/)
71 time(format?: string): string; // '03:08:02' (see available formatters http://momentjs.com/docs/#/parsing/string-format/)
72 century: string; // 'IV'
73 am_pm: string; // 'am'
74 day_of_year: number; // 323
75 day_of_month: number; // 9
76 day_of_week: number; // 4
77 month_number: number; // 9
78 month_name: string; // 'March'
79 year: number; // 1990
80 timezone: string; // 'America/Miquelon'
81
82 // Payments
83
84 card_type: string; // 'American Express'
85 card_number(vendor?: string): string; // '4716506247152101' (if no vendor specified then random)
86 card_exp: string; // '03/04'
87 card_data: {type: string, number: string, exp: string, holder_name: string}; // { type: 'MasterCard', number: '5307558778577046', exp: '04/88', holder_name: 'Jaron Gibson' }
88
89 // Misc
90
91 country_code: string; // 'ES'
92 language_code: string; // 'ru'
93 locale: string; // 'hi_IN'
94 mime_type: string; // 'audio/mpeg'
95 file_extension: string; // 'rtf'
96
97 // Colors
98
99 color_name: string; // 'DarkOliveGreen'
100 safe_color_name: string; // 'maroon'
101 rgb_hex: string; // '#2e4e1f'
102 rgb_array: Array<number> // [ 194, 193, 166 ]
103}
104
105 export const casual: casual;
106
107}
\No newline at end of file