express-sweet 1.0.40 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -6
- package/INSTALL-Redis.md +65 -39
- package/README.md +7 -0
- package/dist/build.common.js +66 -19
- package/dist/build.esm.js +66 -19
- package/docs/index.html +11 -3
- package/package.json +12 -20
- package/types/database/Database.d.ts +181 -181
- package/types/database/Model.d.ts +221 -221
- package/types/database/index.d.ts +3 -4
- package/types/database/loadModels.d.ts +6 -6
- package/types/exceptions/FaceCollectionCreateFailed.d.ts +25 -25
- package/types/exceptions/FaceCollectionDeleteFailed.d.ts +25 -25
- package/types/exceptions/FaceIndexFailed.d.ts +20 -20
- package/types/exceptions/FaceMissingInPhoto.d.ts +11 -11
- package/types/exceptions/FacesMultipleInPhoto.d.ts +11 -11
- package/types/exceptions/index.d.ts +5 -6
- package/types/handlebars_helpers/comparison.d.ts +351 -351
- package/types/handlebars_helpers/date.d.ts +19 -19
- package/types/handlebars_helpers/html.d.ts +12 -12
- package/types/handlebars_helpers/index.d.ts +7 -8
- package/types/handlebars_helpers/math.d.ts +81 -81
- package/types/handlebars_helpers/number.d.ts +18 -18
- package/types/handlebars_helpers/object.d.ts +21 -21
- package/types/handlebars_helpers/string.d.ts +50 -50
- package/types/index.d.ts +7 -8
- package/types/interfaces/AuthenticationConfig.d.ts +108 -108
- package/types/interfaces/BasicConfig.d.ts +74 -74
- package/types/interfaces/BoundingBox.d.ts +25 -25
- package/types/interfaces/DatabaseConfig.d.ts +7 -7
- package/types/interfaces/FaceDetails.d.ts +30 -0
- package/types/interfaces/FaceDetailsEmotions.d.ts +40 -40
- package/types/interfaces/FaceMatch.d.ts +31 -31
- package/types/interfaces/IndexFaceDetails.d.ts +29 -0
- package/types/interfaces/RekognitionOptions.d.ts +26 -26
- package/types/interfaces/SesOptions.d.ts +27 -27
- package/types/interfaces/ViewConfig.d.ts +44 -44
- package/types/interfaces/index.d.ts +8 -9
- package/types/middlewares/Authentication.d.ts +13 -13
- package/types/middlewares/CORS.d.ts +10 -10
- package/types/middlewares/Environment.d.ts +10 -10
- package/types/middlewares/ErrorHandler.d.ts +10 -10
- package/types/middlewares/Global.d.ts +13 -13
- package/types/middlewares/Http.d.ts +10 -10
- package/types/middlewares/Local.d.ts +13 -13
- package/types/middlewares/View.d.ts +14 -14
- package/types/middlewares/index.d.ts +7 -8
- package/types/mount.d.ts +7 -7
- package/types/routing/Router.d.ts +13 -13
- package/types/routing/index.d.ts +1 -2
- package/types/services/AWSRekognitionClient.d.ts +126 -118
- package/types/services/AWSSesClient.d.ts +57 -57
- package/types/services/Authentication.d.ts +34 -34
- package/types/services/index.d.ts +3 -4
- package/types/utils/Types.d.ts +24 -24
- package/types/utils/index.d.ts +9 -12
- package/types/utils/isArray.d.ts +8 -8
- package/types/utils/isAsyncFunction.d.ts +12 -12
- package/types/utils/isFunction.d.ts +13 -13
- package/types/utils/isObject.d.ts +8 -8
- package/types/utils/isString.d.ts +8 -8
- package/types/utils/loadAuthenticationConfig.d.ts +8 -8
- package/types/utils/loadBasicConfig.d.ts +8 -8
- package/types/utils/loadDatabaseConfig.d.ts +8 -8
- package/types/utils/loadViewConfig.d.ts +8 -8
- package/types/services/RedisClient.d.ts +0 -80
|
@@ -1,351 +1,351 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Determine whether or not two values are equal (===).
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* {{!-- results in: false --}}
|
|
6
|
-
* {{eq '3' 3}}
|
|
7
|
-
*
|
|
8
|
-
* {{#if (eqw foo 'bar')}}
|
|
9
|
-
* Hello
|
|
10
|
-
* {{/if}}
|
|
11
|
-
*
|
|
12
|
-
* @param {any} value1 First value to be compared with second.
|
|
13
|
-
* @param {any} value2 Second value to be compared with first.
|
|
14
|
-
* @returns {boolean} Returns true if the value and type are the same, false if they are different.
|
|
15
|
-
*/
|
|
16
|
-
export declare function eq(value1: any, value2: any): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Determine whether or not two values are equal (==) i.e weak checking.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* {{!-- results in: true --}}
|
|
22
|
-
* {{eqw '3' 3}}
|
|
23
|
-
*
|
|
24
|
-
* {{#if (eqw foo 'bar')}}
|
|
25
|
-
* Hello
|
|
26
|
-
* {/if}}
|
|
27
|
-
*
|
|
28
|
-
* @param {any} value1 First value to be compared with second.
|
|
29
|
-
* @param {any} value2 Second value to be compared with first.
|
|
30
|
-
* @returns {boolean} Returns true if the values are the same, false if they are different.
|
|
31
|
-
*/
|
|
32
|
-
export declare function eqw(value1: any, value2: any): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Determine whether or not two values are not equal (!==).
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* {{!-- results in: true --}}
|
|
38
|
-
* {{neq 4 3}}
|
|
39
|
-
*
|
|
40
|
-
* {{#if (neq foo 'bar')}}
|
|
41
|
-
* Hello
|
|
42
|
-
* {{/if}}
|
|
43
|
-
*
|
|
44
|
-
* @param {any} value1 First value to be compared with second.
|
|
45
|
-
* @param {any} value2 Second value to be compared with first.
|
|
46
|
-
* @returns {boolean} Returns true if the value and type are different, false if they are the same.
|
|
47
|
-
*/
|
|
48
|
-
export declare function neq(value1: any, value2: any): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Determine whether or not two values are not equal (!=) weak checking.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* {{!-- results in: false --}}
|
|
54
|
-
* {{neqw '3' 3}}
|
|
55
|
-
*
|
|
56
|
-
* {{#if (neqw foo 'bar')}}
|
|
57
|
-
* Hello
|
|
58
|
-
* {{/if}}
|
|
59
|
-
*
|
|
60
|
-
* @param {any} value1 First value to be compared with second.
|
|
61
|
-
* @param {any} value2 Second value to be compared with first.
|
|
62
|
-
* @returns {boolean} Returns true if the values are different, false if they are the same.
|
|
63
|
-
*/
|
|
64
|
-
export declare function neqw(value1: any, value2: any): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Check for less than condition (a < b).
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* {{!-- results in: true --}}
|
|
70
|
-
* {{lt 2 3}}
|
|
71
|
-
*
|
|
72
|
-
* {{#if (lt 2 5)}}
|
|
73
|
-
* Hello
|
|
74
|
-
* {{/if}}
|
|
75
|
-
*
|
|
76
|
-
* @param {any} value1 First value to be compared with second.
|
|
77
|
-
* @param {any} value2 Second value to be compared with first.
|
|
78
|
-
* @returns {boolean} Returns true if the first value is less than the second value, false otherwise.
|
|
79
|
-
*/
|
|
80
|
-
export declare function lt(value1: any, value2: any): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Check for less than or equals condition (a <= b).
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* {{!-- results in: true --}}
|
|
86
|
-
* {{lte 2 3}}
|
|
87
|
-
*
|
|
88
|
-
* {{#if (lte 2 5)}}
|
|
89
|
-
* Hello
|
|
90
|
-
* {{/if}}
|
|
91
|
-
*
|
|
92
|
-
* @param {any} value1 First value to be compared with second.
|
|
93
|
-
* @param {any} value2 Second value to be compared with first.
|
|
94
|
-
* @returns {boolean} Returns true if the first value is less than or equal to the second value, false otherwise.
|
|
95
|
-
*/
|
|
96
|
-
export declare function lte(value1: any, value2: any): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Check for greater than condition (a > b).
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* {{!-- results in: false --}}
|
|
102
|
-
* {{gt 2 3}}
|
|
103
|
-
*
|
|
104
|
-
* {{#if (gt 5 6)}}
|
|
105
|
-
* Hello
|
|
106
|
-
* {{/if}}
|
|
107
|
-
*
|
|
108
|
-
* @param {any} value1 First value to be compared with second.
|
|
109
|
-
* @param {any} value2 Second value to be compared with first.
|
|
110
|
-
* @returns {boolean} Returns true if the first value exceeds the second value, false otherwise.
|
|
111
|
-
*/
|
|
112
|
-
export declare function gt(value1: any, value2: any): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Check for greater than or equals condition (a >= b).
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* {{!-- results in: true --}}
|
|
118
|
-
* {{gte 3 3}}
|
|
119
|
-
*
|
|
120
|
-
* {{#if (gte 10 2)}}
|
|
121
|
-
* Hello
|
|
122
|
-
* {{/if}}
|
|
123
|
-
*
|
|
124
|
-
* @param {any} value1 First value to be compared with second.
|
|
125
|
-
* @param {any} value2 Second value to be compared with first.
|
|
126
|
-
* @returns {boolean} Returns true if the first value is greater than or equal to the second value, false otherwise.
|
|
127
|
-
*/
|
|
128
|
-
export declare function gte(value1: any, value2: any): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Logical NOT of any expression.
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* {{!-- results in: false --}}
|
|
134
|
-
* {{not true}}
|
|
135
|
-
*
|
|
136
|
-
* {{!-- results in: true --}}
|
|
137
|
-
* {{not false}}
|
|
138
|
-
*
|
|
139
|
-
* {{#if (not (eq foo 'bar'))}}
|
|
140
|
-
* Hello
|
|
141
|
-
* {{/if}}
|
|
142
|
-
*
|
|
143
|
-
* @param {any} expression Any expression.
|
|
144
|
-
* @returns {boolean} Returns the logical negation of the value.
|
|
145
|
-
*/
|
|
146
|
-
export declare function not(expression: any): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Helper to imitate the ternary '?:' conditional operator.
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* {{!-- results in: foo --}}
|
|
152
|
-
* {{ifx true 'foo' 'bar'}}
|
|
153
|
-
*
|
|
154
|
-
* {{!-- results in: bar --}}
|
|
155
|
-
* {{ifx false 'foo' 'bar'}}
|
|
156
|
-
*
|
|
157
|
-
* {{!-- results in: 6 --}}
|
|
158
|
-
* {{ifx (eq value 1) 5 6}}
|
|
159
|
-
*
|
|
160
|
-
* {{!-- results in: 6 --}}
|
|
161
|
-
* {{ifx (not (eq value 1)) 5 6}}
|
|
162
|
-
*
|
|
163
|
-
* {{!-- The third parameter is optional, and by default it will be blank string ('') --}}
|
|
164
|
-
* {{!-- results in: active --}}
|
|
165
|
-
* {{ifx true 'active'}}
|
|
166
|
-
*
|
|
167
|
-
* {{!-- results in: '' --}}
|
|
168
|
-
* {{ifx false 'active'}}
|
|
169
|
-
*
|
|
170
|
-
* @param {boolean} condition Satisfying condition for getting first value. Either true of false.
|
|
171
|
-
* @param {any} value1 First value to be displayed as result..
|
|
172
|
-
* @param {any} value2 Second value to be displayed as result. Defaults to an empty string.
|
|
173
|
-
* @returns {any} Returns the result of the ternary operator.
|
|
174
|
-
*/
|
|
175
|
-
export declare function ifx(condition: boolean, value1: any, value2: any): any;
|
|
176
|
-
/**
|
|
177
|
-
* Check if it is empty.
|
|
178
|
-
* If the value is an array, returns true if there are no elements.
|
|
179
|
-
* If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* {{!-- results in: false --}}
|
|
183
|
-
* {{empty [5, 6]}}
|
|
184
|
-
*
|
|
185
|
-
* {{#if (empty 'foo')}}
|
|
186
|
-
* Hello
|
|
187
|
-
* {{/if}}
|
|
188
|
-
*
|
|
189
|
-
* {{!-- results in: false --}}
|
|
190
|
-
* {{empty 'Hello'}}
|
|
191
|
-
*
|
|
192
|
-
* {{!-- results in: true --}}
|
|
193
|
-
* {{empty ''}}
|
|
194
|
-
*
|
|
195
|
-
* {{!-- results in: true --}}
|
|
196
|
-
* {{empty ' '}}
|
|
197
|
-
*
|
|
198
|
-
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
199
|
-
* @returns {boolean} Returns true if the value is empty, false otherwise.
|
|
200
|
-
*/
|
|
201
|
-
export declare function empty(value: any): boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Check that it is not empty.
|
|
204
|
-
* If the value is an array, returns true if there is an element.
|
|
205
|
-
* If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* {{!-- results in: true --}}
|
|
209
|
-
* {{notEmpty [5, 6]}}
|
|
210
|
-
*
|
|
211
|
-
* {{#if (notEmpty 'foo')}}
|
|
212
|
-
* Hello
|
|
213
|
-
* {{/if}}
|
|
214
|
-
*
|
|
215
|
-
* {{!-- results in: true --}}
|
|
216
|
-
* {{notEmpty 'Hello'}}
|
|
217
|
-
*
|
|
218
|
-
* {{!-- results in: false --}}
|
|
219
|
-
* {{notEmpty ''}}
|
|
220
|
-
*
|
|
221
|
-
* {{!-- results in: false --}}
|
|
222
|
-
* {{notEmpty ' '}}
|
|
223
|
-
*
|
|
224
|
-
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
225
|
-
* @returns {boolean} Returns true if the value is not empty, false otherwise.
|
|
226
|
-
*/
|
|
227
|
-
export declare function notEmpty(value: any): boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Determine the length of an array.
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* {{!-- results in: 2 --}}
|
|
233
|
-
* {{count [5, 6]}}
|
|
234
|
-
*
|
|
235
|
-
* @param {any[]} items Array whose elements to be counted.
|
|
236
|
-
* @returns {number|false} Returns the length of the array if the value is an array, false if the value is not an array.
|
|
237
|
-
*/
|
|
238
|
-
export declare function count(items: any[]): number | false;
|
|
239
|
-
/**
|
|
240
|
-
* Returns the boolean AND of two or more parameters passed i.e it is true iff all the parameters are true.
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* {{!-- results in: true --}}
|
|
244
|
-
* {{and true true}}
|
|
245
|
-
*
|
|
246
|
-
* {{!-- results in: false --}}
|
|
247
|
-
* {{and false true}}
|
|
248
|
-
*
|
|
249
|
-
* {{#if (and value1 value2)}}
|
|
250
|
-
* {{!-- do something --}}
|
|
251
|
-
* {{else}}
|
|
252
|
-
* {{!-- do something else --}}
|
|
253
|
-
* {{/if}}
|
|
254
|
-
*
|
|
255
|
-
* @param {...any} params Any number of boolean parameters.
|
|
256
|
-
* @returns {boolean} Returns the result of the logical product.
|
|
257
|
-
*/
|
|
258
|
-
export declare function and(...params: any[]): boolean;
|
|
259
|
-
/**
|
|
260
|
-
* Returns the boolean OR of two or more parameters passed i.e it is true if any of the parameters is true.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* {{!-- results in: true --}}
|
|
264
|
-
* {{or true false}}
|
|
265
|
-
*
|
|
266
|
-
* {{!-- results in: false --}}
|
|
267
|
-
* {{or false false}}
|
|
268
|
-
*
|
|
269
|
-
* {{#if (or value1 value2)}}
|
|
270
|
-
* {{!-- do something --}}
|
|
271
|
-
* {{else}}
|
|
272
|
-
* {{!-- do something else --}}
|
|
273
|
-
* {{/if}}
|
|
274
|
-
*
|
|
275
|
-
* @param {...any} params Any number of boolean parameters.
|
|
276
|
-
* @returns {boolean} Returns the result of the OR.
|
|
277
|
-
*/
|
|
278
|
-
export declare function or(...params: any[]): boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Returns the first non-falsy value from the parameter list.
|
|
281
|
-
* Works quite similar to the SQL's "COALESCE()" function, but unlike this checks for the first non-false parameter.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* {{!-- results in: foo bar --}}
|
|
285
|
-
* {{coalesce 'foo bar' 'foob' 'unknown'}}
|
|
286
|
-
*
|
|
287
|
-
* {{!-- results in: foob --}}
|
|
288
|
-
* {{coalesce '' 'foob' 'unknown'}}
|
|
289
|
-
*
|
|
290
|
-
* @param {...any} params Any number of parameters.
|
|
291
|
-
* @returns {any} Returns the first non-false element of the parameter.
|
|
292
|
-
*/
|
|
293
|
-
export declare function coalesce(...params: any[]): any;
|
|
294
|
-
/**
|
|
295
|
-
* Returns boolean if the array contains the element strictly or non-strictly.
|
|
296
|
-
*
|
|
297
|
-
* @example
|
|
298
|
-
* {{!-- results in: true --}}
|
|
299
|
-
* {{includes [1, 2, 3] 2}}
|
|
300
|
-
*
|
|
301
|
-
* {{!-- results in: false --}}
|
|
302
|
-
* {{includes [1, 2, 3] '2'}}
|
|
303
|
-
*
|
|
304
|
-
* {{!-- results in: false --}}
|
|
305
|
-
* {{includes [1, 2, 3] '2' true}}
|
|
306
|
-
*
|
|
307
|
-
* {{!-- results in: true --}}
|
|
308
|
-
* {{includes [1, 2, 3] '2' false}}
|
|
309
|
-
*
|
|
310
|
-
* {{#if (includes [1, 2, 3] '2')}}
|
|
311
|
-
* {{!-- Do something --}}
|
|
312
|
-
* {{/if}}
|
|
313
|
-
*
|
|
314
|
-
* {{ifx (includes [1, 2, 3] '2') 'yes' 'no'}}
|
|
315
|
-
*
|
|
316
|
-
* @param {any[]} items The array.
|
|
317
|
-
* @param {any} value The value to be checked for existence in the array.
|
|
318
|
-
* @param {boolean} strict FALSE for non-strict checking. TRUE by default.
|
|
319
|
-
* @returns {boolean} Returns true if the array contains the specified value, false otherwise.
|
|
320
|
-
*/
|
|
321
|
-
export declare function includes(items: any[], value: any, strict?: boolean): boolean;
|
|
322
|
-
/**
|
|
323
|
-
* Returns true if the given str matches the given regex.
|
|
324
|
-
*
|
|
325
|
-
* @example
|
|
326
|
-
* {{!-- results in: true --}}
|
|
327
|
-
* {{regexMatch 'foobar' 'foo'}}
|
|
328
|
-
*
|
|
329
|
-
* {{!-- results in: false --}}
|
|
330
|
-
* {{regexMatch 'bar' 'foo'}}
|
|
331
|
-
*
|
|
332
|
-
* {{!-- results in: false --}}
|
|
333
|
-
* {{regexMatch 'foobar' '^foo$'}}
|
|
334
|
-
*
|
|
335
|
-
* {{!-- results in: true --}}
|
|
336
|
-
* {{regexMatch 'Visit Here' 'here' 'i'}}
|
|
337
|
-
*
|
|
338
|
-
* {{!-- results in: false --}}
|
|
339
|
-
* {{regexMatch 'Visit Here' 'here'}}
|
|
340
|
-
*
|
|
341
|
-
* {{!-- results in: Match --}}
|
|
342
|
-
* {{#if (regexMatch 'foobar' 'foo')}}
|
|
343
|
-
* Match
|
|
344
|
-
* {{/if}}
|
|
345
|
-
*
|
|
346
|
-
* @param {string} val The string against which to match the regular expression.
|
|
347
|
-
* @param {string} pattern The text of the regular expression.
|
|
348
|
-
* @param {string} flags? Regular expression flags, such as global and case-insensitive searches. The default is none (undefined).
|
|
349
|
-
* @returns {boolean} true if there is a match between the regular expression and the string str. Otherwise, false.
|
|
350
|
-
*/
|
|
351
|
-
export declare function regexMatch(val: string, pattern: string, flags?: string): boolean;
|
|
1
|
+
/**
|
|
2
|
+
* Determine whether or not two values are equal (===).
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* {{!-- results in: false --}}
|
|
6
|
+
* {{eq '3' 3}}
|
|
7
|
+
*
|
|
8
|
+
* {{#if (eqw foo 'bar')}}
|
|
9
|
+
* Hello
|
|
10
|
+
* {{/if}}
|
|
11
|
+
*
|
|
12
|
+
* @param {any} value1 First value to be compared with second.
|
|
13
|
+
* @param {any} value2 Second value to be compared with first.
|
|
14
|
+
* @returns {boolean} Returns true if the value and type are the same, false if they are different.
|
|
15
|
+
*/
|
|
16
|
+
export declare function eq(value1: any, value2: any): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Determine whether or not two values are equal (==) i.e weak checking.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* {{!-- results in: true --}}
|
|
22
|
+
* {{eqw '3' 3}}
|
|
23
|
+
*
|
|
24
|
+
* {{#if (eqw foo 'bar')}}
|
|
25
|
+
* Hello
|
|
26
|
+
* {/if}}
|
|
27
|
+
*
|
|
28
|
+
* @param {any} value1 First value to be compared with second.
|
|
29
|
+
* @param {any} value2 Second value to be compared with first.
|
|
30
|
+
* @returns {boolean} Returns true if the values are the same, false if they are different.
|
|
31
|
+
*/
|
|
32
|
+
export declare function eqw(value1: any, value2: any): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Determine whether or not two values are not equal (!==).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* {{!-- results in: true --}}
|
|
38
|
+
* {{neq 4 3}}
|
|
39
|
+
*
|
|
40
|
+
* {{#if (neq foo 'bar')}}
|
|
41
|
+
* Hello
|
|
42
|
+
* {{/if}}
|
|
43
|
+
*
|
|
44
|
+
* @param {any} value1 First value to be compared with second.
|
|
45
|
+
* @param {any} value2 Second value to be compared with first.
|
|
46
|
+
* @returns {boolean} Returns true if the value and type are different, false if they are the same.
|
|
47
|
+
*/
|
|
48
|
+
export declare function neq(value1: any, value2: any): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Determine whether or not two values are not equal (!=) weak checking.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* {{!-- results in: false --}}
|
|
54
|
+
* {{neqw '3' 3}}
|
|
55
|
+
*
|
|
56
|
+
* {{#if (neqw foo 'bar')}}
|
|
57
|
+
* Hello
|
|
58
|
+
* {{/if}}
|
|
59
|
+
*
|
|
60
|
+
* @param {any} value1 First value to be compared with second.
|
|
61
|
+
* @param {any} value2 Second value to be compared with first.
|
|
62
|
+
* @returns {boolean} Returns true if the values are different, false if they are the same.
|
|
63
|
+
*/
|
|
64
|
+
export declare function neqw(value1: any, value2: any): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check for less than condition (a < b).
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* {{!-- results in: true --}}
|
|
70
|
+
* {{lt 2 3}}
|
|
71
|
+
*
|
|
72
|
+
* {{#if (lt 2 5)}}
|
|
73
|
+
* Hello
|
|
74
|
+
* {{/if}}
|
|
75
|
+
*
|
|
76
|
+
* @param {any} value1 First value to be compared with second.
|
|
77
|
+
* @param {any} value2 Second value to be compared with first.
|
|
78
|
+
* @returns {boolean} Returns true if the first value is less than the second value, false otherwise.
|
|
79
|
+
*/
|
|
80
|
+
export declare function lt(value1: any, value2: any): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Check for less than or equals condition (a <= b).
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* {{!-- results in: true --}}
|
|
86
|
+
* {{lte 2 3}}
|
|
87
|
+
*
|
|
88
|
+
* {{#if (lte 2 5)}}
|
|
89
|
+
* Hello
|
|
90
|
+
* {{/if}}
|
|
91
|
+
*
|
|
92
|
+
* @param {any} value1 First value to be compared with second.
|
|
93
|
+
* @param {any} value2 Second value to be compared with first.
|
|
94
|
+
* @returns {boolean} Returns true if the first value is less than or equal to the second value, false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
export declare function lte(value1: any, value2: any): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Check for greater than condition (a > b).
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* {{!-- results in: false --}}
|
|
102
|
+
* {{gt 2 3}}
|
|
103
|
+
*
|
|
104
|
+
* {{#if (gt 5 6)}}
|
|
105
|
+
* Hello
|
|
106
|
+
* {{/if}}
|
|
107
|
+
*
|
|
108
|
+
* @param {any} value1 First value to be compared with second.
|
|
109
|
+
* @param {any} value2 Second value to be compared with first.
|
|
110
|
+
* @returns {boolean} Returns true if the first value exceeds the second value, false otherwise.
|
|
111
|
+
*/
|
|
112
|
+
export declare function gt(value1: any, value2: any): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Check for greater than or equals condition (a >= b).
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* {{!-- results in: true --}}
|
|
118
|
+
* {{gte 3 3}}
|
|
119
|
+
*
|
|
120
|
+
* {{#if (gte 10 2)}}
|
|
121
|
+
* Hello
|
|
122
|
+
* {{/if}}
|
|
123
|
+
*
|
|
124
|
+
* @param {any} value1 First value to be compared with second.
|
|
125
|
+
* @param {any} value2 Second value to be compared with first.
|
|
126
|
+
* @returns {boolean} Returns true if the first value is greater than or equal to the second value, false otherwise.
|
|
127
|
+
*/
|
|
128
|
+
export declare function gte(value1: any, value2: any): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Logical NOT of any expression.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* {{!-- results in: false --}}
|
|
134
|
+
* {{not true}}
|
|
135
|
+
*
|
|
136
|
+
* {{!-- results in: true --}}
|
|
137
|
+
* {{not false}}
|
|
138
|
+
*
|
|
139
|
+
* {{#if (not (eq foo 'bar'))}}
|
|
140
|
+
* Hello
|
|
141
|
+
* {{/if}}
|
|
142
|
+
*
|
|
143
|
+
* @param {any} expression Any expression.
|
|
144
|
+
* @returns {boolean} Returns the logical negation of the value.
|
|
145
|
+
*/
|
|
146
|
+
export declare function not(expression: any): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Helper to imitate the ternary '?:' conditional operator.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* {{!-- results in: foo --}}
|
|
152
|
+
* {{ifx true 'foo' 'bar'}}
|
|
153
|
+
*
|
|
154
|
+
* {{!-- results in: bar --}}
|
|
155
|
+
* {{ifx false 'foo' 'bar'}}
|
|
156
|
+
*
|
|
157
|
+
* {{!-- results in: 6 --}}
|
|
158
|
+
* {{ifx (eq value 1) 5 6}}
|
|
159
|
+
*
|
|
160
|
+
* {{!-- results in: 6 --}}
|
|
161
|
+
* {{ifx (not (eq value 1)) 5 6}}
|
|
162
|
+
*
|
|
163
|
+
* {{!-- The third parameter is optional, and by default it will be blank string ('') --}}
|
|
164
|
+
* {{!-- results in: active --}}
|
|
165
|
+
* {{ifx true 'active'}}
|
|
166
|
+
*
|
|
167
|
+
* {{!-- results in: '' --}}
|
|
168
|
+
* {{ifx false 'active'}}
|
|
169
|
+
*
|
|
170
|
+
* @param {boolean} condition Satisfying condition for getting first value. Either true of false.
|
|
171
|
+
* @param {any} value1 First value to be displayed as result..
|
|
172
|
+
* @param {any} value2 Second value to be displayed as result. Defaults to an empty string.
|
|
173
|
+
* @returns {any} Returns the result of the ternary operator.
|
|
174
|
+
*/
|
|
175
|
+
export declare function ifx(condition: boolean, value1: any, value2: any): any;
|
|
176
|
+
/**
|
|
177
|
+
* Check if it is empty.
|
|
178
|
+
* If the value is an array, returns true if there are no elements.
|
|
179
|
+
* If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* {{!-- results in: false --}}
|
|
183
|
+
* {{empty [5, 6]}}
|
|
184
|
+
*
|
|
185
|
+
* {{#if (empty 'foo')}}
|
|
186
|
+
* Hello
|
|
187
|
+
* {{/if}}
|
|
188
|
+
*
|
|
189
|
+
* {{!-- results in: false --}}
|
|
190
|
+
* {{empty 'Hello'}}
|
|
191
|
+
*
|
|
192
|
+
* {{!-- results in: true --}}
|
|
193
|
+
* {{empty ''}}
|
|
194
|
+
*
|
|
195
|
+
* {{!-- results in: true --}}
|
|
196
|
+
* {{empty ' '}}
|
|
197
|
+
*
|
|
198
|
+
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
199
|
+
* @returns {boolean} Returns true if the value is empty, false otherwise.
|
|
200
|
+
*/
|
|
201
|
+
export declare function empty(value: any): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Check that it is not empty.
|
|
204
|
+
* If the value is an array, returns true if there is an element.
|
|
205
|
+
* If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* {{!-- results in: true --}}
|
|
209
|
+
* {{notEmpty [5, 6]}}
|
|
210
|
+
*
|
|
211
|
+
* {{#if (notEmpty 'foo')}}
|
|
212
|
+
* Hello
|
|
213
|
+
* {{/if}}
|
|
214
|
+
*
|
|
215
|
+
* {{!-- results in: true --}}
|
|
216
|
+
* {{notEmpty 'Hello'}}
|
|
217
|
+
*
|
|
218
|
+
* {{!-- results in: false --}}
|
|
219
|
+
* {{notEmpty ''}}
|
|
220
|
+
*
|
|
221
|
+
* {{!-- results in: false --}}
|
|
222
|
+
* {{notEmpty ' '}}
|
|
223
|
+
*
|
|
224
|
+
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
225
|
+
* @returns {boolean} Returns true if the value is not empty, false otherwise.
|
|
226
|
+
*/
|
|
227
|
+
export declare function notEmpty(value: any): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Determine the length of an array.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* {{!-- results in: 2 --}}
|
|
233
|
+
* {{count [5, 6]}}
|
|
234
|
+
*
|
|
235
|
+
* @param {any[]} items Array whose elements to be counted.
|
|
236
|
+
* @returns {number|false} Returns the length of the array if the value is an array, false if the value is not an array.
|
|
237
|
+
*/
|
|
238
|
+
export declare function count(items: any[]): number | false;
|
|
239
|
+
/**
|
|
240
|
+
* Returns the boolean AND of two or more parameters passed i.e it is true iff all the parameters are true.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* {{!-- results in: true --}}
|
|
244
|
+
* {{and true true}}
|
|
245
|
+
*
|
|
246
|
+
* {{!-- results in: false --}}
|
|
247
|
+
* {{and false true}}
|
|
248
|
+
*
|
|
249
|
+
* {{#if (and value1 value2)}}
|
|
250
|
+
* {{!-- do something --}}
|
|
251
|
+
* {{else}}
|
|
252
|
+
* {{!-- do something else --}}
|
|
253
|
+
* {{/if}}
|
|
254
|
+
*
|
|
255
|
+
* @param {...any} params Any number of boolean parameters.
|
|
256
|
+
* @returns {boolean} Returns the result of the logical product.
|
|
257
|
+
*/
|
|
258
|
+
export declare function and(...params: any[]): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Returns the boolean OR of two or more parameters passed i.e it is true if any of the parameters is true.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* {{!-- results in: true --}}
|
|
264
|
+
* {{or true false}}
|
|
265
|
+
*
|
|
266
|
+
* {{!-- results in: false --}}
|
|
267
|
+
* {{or false false}}
|
|
268
|
+
*
|
|
269
|
+
* {{#if (or value1 value2)}}
|
|
270
|
+
* {{!-- do something --}}
|
|
271
|
+
* {{else}}
|
|
272
|
+
* {{!-- do something else --}}
|
|
273
|
+
* {{/if}}
|
|
274
|
+
*
|
|
275
|
+
* @param {...any} params Any number of boolean parameters.
|
|
276
|
+
* @returns {boolean} Returns the result of the OR.
|
|
277
|
+
*/
|
|
278
|
+
export declare function or(...params: any[]): boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Returns the first non-falsy value from the parameter list.
|
|
281
|
+
* Works quite similar to the SQL's "COALESCE()" function, but unlike this checks for the first non-false parameter.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* {{!-- results in: foo bar --}}
|
|
285
|
+
* {{coalesce 'foo bar' 'foob' 'unknown'}}
|
|
286
|
+
*
|
|
287
|
+
* {{!-- results in: foob --}}
|
|
288
|
+
* {{coalesce '' 'foob' 'unknown'}}
|
|
289
|
+
*
|
|
290
|
+
* @param {...any} params Any number of parameters.
|
|
291
|
+
* @returns {any} Returns the first non-false element of the parameter.
|
|
292
|
+
*/
|
|
293
|
+
export declare function coalesce(...params: any[]): any;
|
|
294
|
+
/**
|
|
295
|
+
* Returns boolean if the array contains the element strictly or non-strictly.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* {{!-- results in: true --}}
|
|
299
|
+
* {{includes [1, 2, 3] 2}}
|
|
300
|
+
*
|
|
301
|
+
* {{!-- results in: false --}}
|
|
302
|
+
* {{includes [1, 2, 3] '2'}}
|
|
303
|
+
*
|
|
304
|
+
* {{!-- results in: false --}}
|
|
305
|
+
* {{includes [1, 2, 3] '2' true}}
|
|
306
|
+
*
|
|
307
|
+
* {{!-- results in: true --}}
|
|
308
|
+
* {{includes [1, 2, 3] '2' false}}
|
|
309
|
+
*
|
|
310
|
+
* {{#if (includes [1, 2, 3] '2')}}
|
|
311
|
+
* {{!-- Do something --}}
|
|
312
|
+
* {{/if}}
|
|
313
|
+
*
|
|
314
|
+
* {{ifx (includes [1, 2, 3] '2') 'yes' 'no'}}
|
|
315
|
+
*
|
|
316
|
+
* @param {any[]} items The array.
|
|
317
|
+
* @param {any} value The value to be checked for existence in the array.
|
|
318
|
+
* @param {boolean} strict FALSE for non-strict checking. TRUE by default.
|
|
319
|
+
* @returns {boolean} Returns true if the array contains the specified value, false otherwise.
|
|
320
|
+
*/
|
|
321
|
+
export declare function includes(items: any[], value: any, strict?: boolean): boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Returns true if the given str matches the given regex.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* {{!-- results in: true --}}
|
|
327
|
+
* {{regexMatch 'foobar' 'foo'}}
|
|
328
|
+
*
|
|
329
|
+
* {{!-- results in: false --}}
|
|
330
|
+
* {{regexMatch 'bar' 'foo'}}
|
|
331
|
+
*
|
|
332
|
+
* {{!-- results in: false --}}
|
|
333
|
+
* {{regexMatch 'foobar' '^foo$'}}
|
|
334
|
+
*
|
|
335
|
+
* {{!-- results in: true --}}
|
|
336
|
+
* {{regexMatch 'Visit Here' 'here' 'i'}}
|
|
337
|
+
*
|
|
338
|
+
* {{!-- results in: false --}}
|
|
339
|
+
* {{regexMatch 'Visit Here' 'here'}}
|
|
340
|
+
*
|
|
341
|
+
* {{!-- results in: Match --}}
|
|
342
|
+
* {{#if (regexMatch 'foobar' 'foo')}}
|
|
343
|
+
* Match
|
|
344
|
+
* {{/if}}
|
|
345
|
+
*
|
|
346
|
+
* @param {string} val The string against which to match the regular expression.
|
|
347
|
+
* @param {string} pattern The text of the regular expression.
|
|
348
|
+
* @param {string} flags? Regular expression flags, such as global and case-insensitive searches. The default is none (undefined).
|
|
349
|
+
* @returns {boolean} true if there is a match between the regular expression and the string str. Otherwise, false.
|
|
350
|
+
*/
|
|
351
|
+
export declare function regexMatch(val: string, pattern: string, flags?: string): boolean;
|