@spinajs/templates-handlebars 2.0.425 → 2.0.427

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.
Files changed (57) hide show
  1. package/lib/cjs/helpers/comparison.d.ts +106 -0
  2. package/lib/cjs/helpers/comparison.d.ts.map +1 -0
  3. package/lib/cjs/helpers/comparison.js +201 -0
  4. package/lib/cjs/helpers/comparison.js.map +1 -0
  5. package/lib/cjs/helpers/date.d.ts +113 -0
  6. package/lib/cjs/helpers/date.d.ts.map +1 -0
  7. package/lib/cjs/helpers/date.js +438 -0
  8. package/lib/cjs/helpers/date.js.map +1 -0
  9. package/lib/cjs/helpers/index.d.ts +6 -0
  10. package/lib/cjs/helpers/index.d.ts.map +1 -0
  11. package/lib/cjs/helpers/index.js +22 -0
  12. package/lib/cjs/helpers/index.js.map +1 -0
  13. package/lib/cjs/helpers/math.d.ts +117 -0
  14. package/lib/cjs/helpers/math.d.ts.map +1 -0
  15. package/lib/cjs/helpers/math.js +206 -0
  16. package/lib/cjs/helpers/math.js.map +1 -0
  17. package/lib/cjs/helpers/text.d.ts +142 -0
  18. package/lib/cjs/helpers/text.d.ts.map +1 -0
  19. package/lib/cjs/helpers/text.js +271 -0
  20. package/lib/cjs/helpers/text.js.map +1 -0
  21. package/lib/cjs/helpers/translation.d.ts +21 -0
  22. package/lib/cjs/helpers/translation.d.ts.map +1 -0
  23. package/lib/cjs/helpers/translation.js +36 -0
  24. package/lib/cjs/helpers/translation.js.map +1 -0
  25. package/lib/cjs/index.d.ts.map +1 -1
  26. package/lib/cjs/index.js +6 -31
  27. package/lib/cjs/index.js.map +1 -1
  28. package/lib/mjs/helpers/comparison.d.ts +106 -0
  29. package/lib/mjs/helpers/comparison.d.ts.map +1 -0
  30. package/lib/mjs/helpers/comparison.js +178 -0
  31. package/lib/mjs/helpers/comparison.js.map +1 -0
  32. package/lib/mjs/helpers/date.d.ts +113 -0
  33. package/lib/mjs/helpers/date.d.ts.map +1 -0
  34. package/lib/mjs/helpers/date.js +415 -0
  35. package/lib/mjs/helpers/date.js.map +1 -0
  36. package/lib/mjs/helpers/index.d.ts +6 -0
  37. package/lib/mjs/helpers/index.d.ts.map +1 -0
  38. package/lib/mjs/helpers/index.js +6 -0
  39. package/lib/mjs/helpers/index.js.map +1 -0
  40. package/lib/mjs/helpers/math.d.ts +117 -0
  41. package/lib/mjs/helpers/math.d.ts.map +1 -0
  42. package/lib/mjs/helpers/math.js +181 -0
  43. package/lib/mjs/helpers/math.js.map +1 -0
  44. package/lib/mjs/helpers/text.d.ts +142 -0
  45. package/lib/mjs/helpers/text.d.ts.map +1 -0
  46. package/lib/mjs/helpers/text.js +243 -0
  47. package/lib/mjs/helpers/text.js.map +1 -0
  48. package/lib/mjs/helpers/translation.d.ts +21 -0
  49. package/lib/mjs/helpers/translation.d.ts.map +1 -0
  50. package/lib/mjs/helpers/translation.js +30 -0
  51. package/lib/mjs/helpers/translation.js.map +1 -0
  52. package/lib/mjs/index.d.ts.map +1 -1
  53. package/lib/mjs/index.js +7 -32
  54. package/lib/mjs/index.js.map +1 -1
  55. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  56. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  57. package/package.json +8 -8
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Checks if a number is odd
3
+ * Usage: {{#if (isOdd @index)}}...{{/if}}
4
+ */
5
+ export declare function isOdd(index: number): boolean;
6
+ /**
7
+ * Checks if a number is even
8
+ * Usage: {{#if (isEven @index)}}...{{/if}}
9
+ */
10
+ export declare function isEven(index: number): boolean;
11
+ /**
12
+ * Equality comparison
13
+ * Usage: {{#if (eq a b)}}...{{/if}}
14
+ */
15
+ export declare function eq(a: any, b: any): boolean;
16
+ /**
17
+ * Not equal comparison
18
+ * Usage: {{#if (ne a b)}}...{{/if}}
19
+ */
20
+ export declare function ne(a: any, b: any): boolean;
21
+ /**
22
+ * Less than comparison
23
+ * Usage: {{#if (lt a b)}}...{{/if}}
24
+ */
25
+ export declare function lt(a: any, b: any): boolean;
26
+ /**
27
+ * Greater than comparison
28
+ * Usage: {{#if (gt a b)}}...{{/if}}
29
+ */
30
+ export declare function gt(a: any, b: any): boolean;
31
+ /**
32
+ * Less than or equal comparison
33
+ * Usage: {{#if (lte a b)}}...{{/if}}
34
+ */
35
+ export declare function lte(a: any, b: any): boolean;
36
+ /**
37
+ * Greater than or equal comparison
38
+ * Usage: {{#if (gte a b)}}...{{/if}}
39
+ */
40
+ export declare function gte(a: any, b: any): boolean;
41
+ /**
42
+ * Logical AND operation
43
+ * Usage: {{#if (and a b)}}...{{/if}}
44
+ */
45
+ export declare function and(...args: any[]): boolean;
46
+ /**
47
+ * Logical OR operation
48
+ * Usage: {{#if (or a b)}}...{{/if}}
49
+ */
50
+ export declare function or(...args: any[]): boolean;
51
+ /**
52
+ * Logical NOT operation
53
+ * Usage: {{#if (not value)}}...{{/if}}
54
+ */
55
+ export declare function not(value: any): boolean;
56
+ /**
57
+ * Check if value is null or undefined
58
+ * Usage: {{#if (isNil value)}}...{{/if}}
59
+ */
60
+ export declare function isNil(value: any): boolean;
61
+ /**
62
+ * Check if value is truthy
63
+ * Usage: {{#if (isTruthy value)}}...{{/if}}
64
+ */
65
+ export declare function isTruthy(value: any): boolean;
66
+ /**
67
+ * Check if value is falsy
68
+ * Usage: {{#if (isFalsy value)}}...{{/if}}
69
+ */
70
+ export declare function isFalsy(value: any): boolean;
71
+ /**
72
+ * Check if value is empty (null, undefined, empty string, empty array, empty object)
73
+ * Usage: {{#if (isEmpty value)}}...{{/if}}
74
+ */
75
+ export declare function isEmpty(value: any): boolean;
76
+ /**
77
+ * Check if value is not empty
78
+ * Usage: {{#if (isNotEmpty value)}}...{{/if}}
79
+ */
80
+ export declare function isNotEmpty(value: any): boolean;
81
+ /**
82
+ * Check if value is in array or string contains substring
83
+ * Usage: {{#if (includes array value)}}...{{/if}}
84
+ */
85
+ export declare function includes(collection: any[] | string, value: any): boolean;
86
+ /**
87
+ * Check if string starts with prefix
88
+ * Usage: {{#if (startsWith str "prefix")}}...{{/if}}
89
+ */
90
+ export declare function startsWith(str: string, prefix: string): boolean;
91
+ /**
92
+ * Check if string ends with suffix
93
+ * Usage: {{#if (endsWith str "suffix")}}...{{/if}}
94
+ */
95
+ export declare function endsWith(str: string, suffix: string): boolean;
96
+ /**
97
+ * Check if value is between min and max (inclusive)
98
+ * Usage: {{#if (between value 1 10)}}...{{/if}}
99
+ */
100
+ export declare function between(value: number, min: number, max: number): boolean;
101
+ /**
102
+ * Compare values with custom operator
103
+ * Usage: {{#if (compare a ">" b)}}...{{/if}}
104
+ */
105
+ export declare function compare(a: any, operator: string, b: any): boolean;
106
+ //# sourceMappingURL=comparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../../src/helpers/comparison.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED;;;GAGG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE1C;AAED;;;GAGG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE1C;AAED;;;GAGG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE1C;AAED;;;GAGG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE1C;AAED;;;GAGG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE3C;AAED;;;GAGG;AACH,wBAAgB,GAA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CAAC,EAAE,GAAG,GAAG,OAAO,CAYjE"}
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOdd = isOdd;
4
+ exports.isEven = isEven;
5
+ exports.eq = eq;
6
+ exports.ne = ne;
7
+ exports.lt = lt;
8
+ exports.gt = gt;
9
+ exports.lte = lte;
10
+ exports.gte = gte;
11
+ exports.and = and;
12
+ exports.or = or;
13
+ exports.not = not;
14
+ exports.isNil = isNil;
15
+ exports.isTruthy = isTruthy;
16
+ exports.isFalsy = isFalsy;
17
+ exports.isEmpty = isEmpty;
18
+ exports.isNotEmpty = isNotEmpty;
19
+ exports.includes = includes;
20
+ exports.startsWith = startsWith;
21
+ exports.endsWith = endsWith;
22
+ exports.between = between;
23
+ exports.compare = compare;
24
+ /**
25
+ * Checks if a number is odd
26
+ * Usage: {{#if (isOdd @index)}}...{{/if}}
27
+ */
28
+ function isOdd(index) {
29
+ return index % 2 !== 0;
30
+ }
31
+ /**
32
+ * Checks if a number is even
33
+ * Usage: {{#if (isEven @index)}}...{{/if}}
34
+ */
35
+ function isEven(index) {
36
+ return index % 2 === 0;
37
+ }
38
+ /**
39
+ * Equality comparison
40
+ * Usage: {{#if (eq a b)}}...{{/if}}
41
+ */
42
+ function eq(a, b) {
43
+ return a === b;
44
+ }
45
+ /**
46
+ * Not equal comparison
47
+ * Usage: {{#if (ne a b)}}...{{/if}}
48
+ */
49
+ function ne(a, b) {
50
+ return a !== b;
51
+ }
52
+ /**
53
+ * Less than comparison
54
+ * Usage: {{#if (lt a b)}}...{{/if}}
55
+ */
56
+ function lt(a, b) {
57
+ return a < b;
58
+ }
59
+ /**
60
+ * Greater than comparison
61
+ * Usage: {{#if (gt a b)}}...{{/if}}
62
+ */
63
+ function gt(a, b) {
64
+ return a > b;
65
+ }
66
+ /**
67
+ * Less than or equal comparison
68
+ * Usage: {{#if (lte a b)}}...{{/if}}
69
+ */
70
+ function lte(a, b) {
71
+ return a <= b;
72
+ }
73
+ /**
74
+ * Greater than or equal comparison
75
+ * Usage: {{#if (gte a b)}}...{{/if}}
76
+ */
77
+ function gte(a, b) {
78
+ return a >= b;
79
+ }
80
+ /**
81
+ * Logical AND operation
82
+ * Usage: {{#if (and a b)}}...{{/if}}
83
+ */
84
+ function and(...args) {
85
+ // Last argument is Handlebars options object
86
+ const values = args.slice(0, -1);
87
+ return values.every(v => !!v);
88
+ }
89
+ /**
90
+ * Logical OR operation
91
+ * Usage: {{#if (or a b)}}...{{/if}}
92
+ */
93
+ function or(...args) {
94
+ // Last argument is Handlebars options object
95
+ const values = args.slice(0, -1);
96
+ return values.some(v => !!v);
97
+ }
98
+ /**
99
+ * Logical NOT operation
100
+ * Usage: {{#if (not value)}}...{{/if}}
101
+ */
102
+ function not(value) {
103
+ return !value;
104
+ }
105
+ /**
106
+ * Check if value is null or undefined
107
+ * Usage: {{#if (isNil value)}}...{{/if}}
108
+ */
109
+ function isNil(value) {
110
+ return value === null || value === undefined;
111
+ }
112
+ /**
113
+ * Check if value is truthy
114
+ * Usage: {{#if (isTruthy value)}}...{{/if}}
115
+ */
116
+ function isTruthy(value) {
117
+ return !!value;
118
+ }
119
+ /**
120
+ * Check if value is falsy
121
+ * Usage: {{#if (isFalsy value)}}...{{/if}}
122
+ */
123
+ function isFalsy(value) {
124
+ return !value;
125
+ }
126
+ /**
127
+ * Check if value is empty (null, undefined, empty string, empty array, empty object)
128
+ * Usage: {{#if (isEmpty value)}}...{{/if}}
129
+ */
130
+ function isEmpty(value) {
131
+ if (value === null || value === undefined)
132
+ return true;
133
+ if (typeof value === 'string' || Array.isArray(value))
134
+ return value.length === 0;
135
+ if (typeof value === 'object')
136
+ return Object.keys(value).length === 0;
137
+ return false;
138
+ }
139
+ /**
140
+ * Check if value is not empty
141
+ * Usage: {{#if (isNotEmpty value)}}...{{/if}}
142
+ */
143
+ function isNotEmpty(value) {
144
+ return !isEmpty(value);
145
+ }
146
+ /**
147
+ * Check if value is in array or string contains substring
148
+ * Usage: {{#if (includes array value)}}...{{/if}}
149
+ */
150
+ function includes(collection, value) {
151
+ if (Array.isArray(collection)) {
152
+ return collection.includes(value);
153
+ }
154
+ if (typeof collection === 'string' && typeof value === 'string') {
155
+ return collection.includes(value);
156
+ }
157
+ return false;
158
+ }
159
+ /**
160
+ * Check if string starts with prefix
161
+ * Usage: {{#if (startsWith str "prefix")}}...{{/if}}
162
+ */
163
+ function startsWith(str, prefix) {
164
+ if (typeof str !== 'string' || typeof prefix !== 'string')
165
+ return false;
166
+ return str.startsWith(prefix);
167
+ }
168
+ /**
169
+ * Check if string ends with suffix
170
+ * Usage: {{#if (endsWith str "suffix")}}...{{/if}}
171
+ */
172
+ function endsWith(str, suffix) {
173
+ if (typeof str !== 'string' || typeof suffix !== 'string')
174
+ return false;
175
+ return str.endsWith(suffix);
176
+ }
177
+ /**
178
+ * Check if value is between min and max (inclusive)
179
+ * Usage: {{#if (between value 1 10)}}...{{/if}}
180
+ */
181
+ function between(value, min, max) {
182
+ return value >= min && value <= max;
183
+ }
184
+ /**
185
+ * Compare values with custom operator
186
+ * Usage: {{#if (compare a ">" b)}}...{{/if}}
187
+ */
188
+ function compare(a, operator, b) {
189
+ switch (operator) {
190
+ case '==': return a == b;
191
+ case '===': return a === b;
192
+ case '!=': return a != b;
193
+ case '!==': return a !== b;
194
+ case '<': return a < b;
195
+ case '>': return a > b;
196
+ case '<=': return a <= b;
197
+ case '>=': return a >= b;
198
+ default: return false;
199
+ }
200
+ }
201
+ //# sourceMappingURL=comparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparison.js","sourceRoot":"","sources":["../../../src/helpers/comparison.ts"],"names":[],"mappings":";;AAIA,sBAEC;AAMD,wBAEC;AAMD,gBAEC;AAMD,gBAEC;AAMD,gBAEC;AAMD,gBAEC;AAMD,kBAEC;AAMD,kBAEC;AAMD,kBAIC;AAMD,gBAIC;AAMD,kBAEC;AAMD,sBAEC;AAMD,4BAEC;AAMD,0BAEC;AAMD,0B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AAG,CAAC,CAAC;QACvB,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Formats a date according to the specified format string
3
+ * Usage: {{formatDate date "dd/MM/yyyy"}}
4
+ *
5
+ * @param date - Can be Date, DateTime, or ISO string
6
+ * @param format - Luxon format string (e.g., "dd/MM/yyyy HH:mm:ss")
7
+ * @returns Formatted date string
8
+ */
9
+ export declare function formatDate(date: unknown, format: string): string;
10
+ /**
11
+ * Get current date/time
12
+ * Usage: {{now "dd/MM/yyyy HH:mm:ss"}}
13
+ */
14
+ export declare function now(format?: string): string;
15
+ /**
16
+ * Get date relative to now (e.g., "2 days ago", "in 3 hours")
17
+ * Usage: {{dateRelative date}}
18
+ */
19
+ export declare function dateRelative(date: unknown): string;
20
+ /**
21
+ * Add time to date
22
+ * Usage: {{dateAdd date 5 "days"}}
23
+ * Units: years, months, weeks, days, hours, minutes, seconds
24
+ */
25
+ export declare function dateAdd(date: unknown, amount: number, unit: string): string;
26
+ /**
27
+ * Subtract time from date
28
+ * Usage: {{dateSubtract date 5 "days"}}
29
+ */
30
+ export declare function dateSubtract(date: unknown, amount: number, unit: string): string;
31
+ /**
32
+ * Get difference between two dates
33
+ * Usage: {{dateDiff date1 date2 "days"}}
34
+ * Returns number of units between dates
35
+ */
36
+ export declare function dateDiff(date1: unknown, date2: unknown, unit?: string): number;
37
+ /**
38
+ * Check if date is before another date
39
+ * Usage: {{#if (dateBefore date1 date2)}}...{{/if}}
40
+ */
41
+ export declare function dateBefore(date1: unknown, date2: unknown): boolean;
42
+ /**
43
+ * Check if date is after another date
44
+ * Usage: {{#if (dateAfter date1 date2)}}...{{/if}}
45
+ */
46
+ export declare function dateAfter(date1: unknown, date2: unknown): boolean;
47
+ /**
48
+ * Check if date is between two dates
49
+ * Usage: {{#if (dateBetween date start end)}}...{{/if}}
50
+ */
51
+ export declare function dateBetween(date: unknown, start: unknown, end: unknown): boolean;
52
+ /**
53
+ * Get start of time period
54
+ * Usage: {{dateStartOf date "month"}}
55
+ * Units: year, month, week, day, hour, minute, second
56
+ */
57
+ export declare function dateStartOf(date: unknown, unit: string): string;
58
+ /**
59
+ * Get end of time period
60
+ * Usage: {{dateEndOf date "month"}}
61
+ */
62
+ export declare function dateEndOf(date: unknown, unit: string): string;
63
+ /**
64
+ * Format date as ISO string
65
+ * Usage: {{dateISO date}}
66
+ */
67
+ export declare function dateISO(date: unknown): string;
68
+ /**
69
+ * Get timestamp (milliseconds since epoch)
70
+ * Usage: {{timestamp date}}
71
+ */
72
+ export declare function timestamp(date?: unknown): number;
73
+ /**
74
+ * Get Unix timestamp (seconds since epoch)
75
+ * Usage: {{unixTimestamp date}}
76
+ */
77
+ export declare function unixTimestamp(date?: unknown): number;
78
+ /**
79
+ * Parse date from timestamp
80
+ * Usage: {{fromTimestamp 1640000000000 "dd/MM/yyyy"}}
81
+ */
82
+ export declare function fromTimestamp(ts: number, format?: string): string;
83
+ /**
84
+ * Get year from date
85
+ * Usage: {{year date}}
86
+ */
87
+ export declare function year(date: unknown): number;
88
+ /**
89
+ * Get month from date (1-12)
90
+ * Usage: {{month date}}
91
+ */
92
+ export declare function month(date: unknown): number;
93
+ /**
94
+ * Get day of month from date (1-31)
95
+ * Usage: {{day date}}
96
+ */
97
+ export declare function day(date: unknown): number;
98
+ /**
99
+ * Get hour from date (0-23)
100
+ * Usage: {{hour date}}
101
+ */
102
+ export declare function hour(date: unknown): number;
103
+ /**
104
+ * Get minute from date (0-59)
105
+ * Usage: {{minute date}}
106
+ */
107
+ export declare function minute(date: unknown): number;
108
+ /**
109
+ * Get weekday from date (1=Monday, 7=Sunday)
110
+ * Usage: {{weekday date}}
111
+ */
112
+ export declare function weekday(date: unknown): number;
113
+ //# sourceMappingURL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