forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsugarpak.d.ts
271 lines (239 loc) · 7.03 KB
/
sugarpak.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
// Type definitions for DateJS - SugarPak Extensions
// Project: http://www.datejs.com/
// Definitions by: David Khristepher Santos <http://github.com/rupertavery>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/** SugarPak.js - Domain Specific Language - Syntactical Sugar */
declare module sugarpak {
export interface IAddOrientation {
millisecond(): IDateJS;
second(): IDateJS;
minute(): IDateJS;
hour(): IDateJS;
day(): IDateJS;
week(): IDateJS;
month(): IDateJS;
year(): IDateJS;
milliseconds(): IDateJS;
seconds(): IDateJS;
minutes(): IDateJS;
hours(): IDateJS;
days(): IDateJS;
weeks(): IDateJS;
months(): IDateJS;
years(): IDateJS;
}
export interface IOrientation extends IAddOrientation {
monday(): IDateJS;
tuesday(): IDateJS;
wednesday(): IDateJS;
thursday(): IDateJS;
friday(): IDateJS;
saturday(): IDateJS;
sunday(): IDateJS;
mon(): IDateJS;
tue(): IDateJS;
wed(): IDateJS;
thu(): IDateJS;
fri(): IDateJS;
sat(): IDateJS;
sun(): IDateJS;
january(): IDateJS;
february(): IDateJS;
march(): IDateJS;
april(): IDateJS;
may(): IDateJS;
june(): IDateJS;
july(): IDateJS;
august(): IDateJS;
september(): IDateJS;
october(): IDateJS;
november(): IDateJS;
december(): IDateJS;
jan(): IDateJS;
feb(): IDateJS;
mar(): IDateJS;
apr(): IDateJS;
// may
jun(): IDateJS;
jul(): IDateJS;
aug(): IDateJS;
sep(): IDateJS;
oct(): IDateJS;
nov(): IDateJS;
dec(): IDateJS;
}
export interface IPredicate {
today(): boolean;
monday(): boolean;
tuesday(): boolean;
wednesday(): boolean;
thursday(): boolean;
friday(): boolean;
saturday(): boolean;
sunday(): boolean;
mon(): boolean;
tue(): boolean;
wed(): boolean;
thu(): boolean;
fri(): boolean;
sat(): boolean;
sun(): boolean;
january(): boolean;
february(): boolean;
march(): boolean;
april(): boolean;
may(): boolean;
june(): boolean;
july(): boolean;
august(): boolean;
september(): boolean;
october(): boolean;
november(): boolean;
december(): boolean;
jan(): boolean;
feb(): boolean;
mar(): boolean;
apr(): boolean;
jun(): boolean;
jul(): boolean;
aug(): boolean;
sep(): boolean;
oct(): boolean;
nov(): boolean;
dec(): boolean;
weekday(): boolean;
day(date?: IDateJS): boolean;
week(date?: IDateJS): boolean;
month(date?: IDateJS): boolean;
year(date?: IDateJS): boolean;
}
export interface IDatePartComparer {
millisecond(date?: IDateJS): boolean;
second(date?: IDateJS): boolean;
minute(date?: IDateJS): boolean;
hour(date?: IDateJS): boolean;
day(date?: IDateJS): boolean;
week(date?: IDateJS): boolean;
month(date?: IDateJS): boolean;
year(date?: IDateJS): boolean;
}
export interface IDateElementEvaluator {
ago(): IDateJS;
before(): IDateJS;
fromNow(): IDateJS;
after(): IDateJS;
}
export interface IDateElement {
millisecond(): IDateElementEvaluator;
second(): IDateElementEvaluator;
minute(): IDateElementEvaluator;
hour(): IDateElementEvaluator;
day(): IDateElementEvaluator;
week(): IDateElementEvaluator;
month(): IDateElementEvaluator;
year(): IDateElementEvaluator;
milliseconds(): IDateElementEvaluator;
seconds(): IDateElementEvaluator;
minutes(): IDateElementEvaluator;
hours(): IDateElementEvaluator;
days(): IDateElementEvaluator;
weeks(): IDateElementEvaluator;
months(): IDateElementEvaluator;
years(): IDateElementEvaluator;
}
export interface IDateLiteral extends ITimeLiteral {
day: number;
week: number;
month: number;
year: number;
}
export interface ITimeLiteral {
millisecond: number;
second: number;
minute: number;
hour: number;
}
}
interface IDateJS {
add(n: number): sugarpak.IAddOrientation;
at(time: string): IDateJS;
at(time: sugarpak.ITimeLiteral): IDateJS;
is(): sugarpak.IPredicate;
next(): sugarpak.IOrientation;
last(): sugarpak.IOrientation;
prev(): sugarpak.IOrientation;
final(): sugarpak.IOrientation;
first(): sugarpak.IOrientation;
second(): sugarpak.IOrientation;
third(): sugarpak.IOrientation;
fourth(): sugarpak.IOrientation;
fifth(): sugarpak.IOrientation;
previous(): sugarpak.IOrientation;
/** Determines if two date objects occur on/in exactly the same instance of the subsequent date part function. Must be followed by a date part function (example: .day(), .month(), .year(), etc) */
same(): sugarpak.IDatePartComparer;
/** Returns a date literal from a DateJS instance */
toObject(): sugarpak.IDateLiteral;
}
interface IDateJSStatic {
/** Contains the day-of-week value for Monday */
MONDAY: number;
/** Contains the day-of-week value for Tuesday */
TUESDAY: number;
/** Contains the day-of-week value for Wednesday */
WEDNESDAY: number;
/** Contains the day-of-week value for Thursday */
THURSDAY: number;
/** Contains the day-of-week value for Friday */
FRIDAY: number;
/** Contains the day-of-week value for Saturday */
SATURDAY: number;
/** Contains the day-of-week value for Sunday */
SUNDAY: number;
/** Instantiates a DateJS object from a literal */
fromObject(date: sugarpak.IDateLiteral): IDateJS;
next(): sugarpak.IOrientation;
last(): sugarpak.IOrientation;
prev(): sugarpak.IOrientation;
previous(): sugarpak.IOrientation;
january(): IDateJS;
february(): IDateJS;
march(): IDateJS;
april(): IDateJS;
may(): IDateJS;
june(): IDateJS;
july(): IDateJS;
august(): IDateJS;
september(): IDateJS;
october(): IDateJS;
november(): IDateJS;
december(): IDateJS;
monday(): IDateJS;
tuesday(): IDateJS;
wednesday(): IDateJS;
thursday(): IDateJS;
friday(): IDateJS;
saturday(): IDateJS;
sunday(): IDateJS;
mon(): IDateJS;
tue(): IDateJS;
wed(): IDateJS;
thu(): IDateJS;
fri(): IDateJS;
sat(): IDateJS;
sun(): IDateJS;
jan(): IDateJS;
feb(): IDateJS;
mar(): IDateJS;
apr(): IDateJS;
// may
jun(): IDateJS;
jul(): IDateJS;
aug(): IDateJS;
sep(): IDateJS;
oct(): IDateJS;
nov(): IDateJS;
dec(): IDateJS;
}
interface Number extends sugarpak.IDateElement {
// extend the Number type with all the IDateJS goodness
}