hron-wasm 0.5.0 → 0.6.0
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/hron_wasm.d.ts +14 -0
- package/hron_wasm_bg.js +53 -0
- package/hron_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/hron_wasm.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export class Schedule {
|
|
|
8
8
|
private constructor();
|
|
9
9
|
free(): void;
|
|
10
10
|
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Returns occurrences in the range (from, to], where from is exclusive and to is inclusive.
|
|
13
|
+
* Returns an array of datetime strings.
|
|
14
|
+
*/
|
|
15
|
+
between(from: string, to: string): any;
|
|
11
16
|
/**
|
|
12
17
|
* Check if a datetime matches this schedule.
|
|
13
18
|
*/
|
|
@@ -20,10 +25,19 @@ export class Schedule {
|
|
|
20
25
|
* Compute the next `n` occurrences after `now`.
|
|
21
26
|
*/
|
|
22
27
|
nextNFrom(now: string, n: number): any;
|
|
28
|
+
/**
|
|
29
|
+
* Returns occurrences starting after `from`, limited to `limit` results.
|
|
30
|
+
* Returns an array of datetime strings.
|
|
31
|
+
*/
|
|
32
|
+
occurrences(from: string, limit: number): any;
|
|
23
33
|
/**
|
|
24
34
|
* Parse an hron expression string.
|
|
25
35
|
*/
|
|
26
36
|
static parse(input: string): Schedule;
|
|
37
|
+
/**
|
|
38
|
+
* Compute the most recent occurrence strictly before `now`.
|
|
39
|
+
*/
|
|
40
|
+
previousFrom(now: string): string | undefined;
|
|
27
41
|
/**
|
|
28
42
|
* Convert this schedule to a cron expression (if possible).
|
|
29
43
|
*/
|
package/hron_wasm_bg.js
CHANGED
|
@@ -19,6 +19,24 @@ export class Schedule {
|
|
|
19
19
|
const ptr = this.__destroy_into_raw();
|
|
20
20
|
wasm.__wbg_schedule_free(ptr, 0);
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns occurrences in the range (from, to], where from is exclusive and to is inclusive.
|
|
24
|
+
* Returns an array of datetime strings.
|
|
25
|
+
* @param {string} from
|
|
26
|
+
* @param {string} to
|
|
27
|
+
* @returns {any}
|
|
28
|
+
*/
|
|
29
|
+
between(from, to) {
|
|
30
|
+
const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
31
|
+
const len0 = WASM_VECTOR_LEN;
|
|
32
|
+
const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
33
|
+
const len1 = WASM_VECTOR_LEN;
|
|
34
|
+
const ret = wasm.schedule_between(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
35
|
+
if (ret[2]) {
|
|
36
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
37
|
+
}
|
|
38
|
+
return takeFromExternrefTable0(ret[0]);
|
|
39
|
+
}
|
|
22
40
|
/**
|
|
23
41
|
* Check if a datetime matches this schedule.
|
|
24
42
|
* @param {string} datetime
|
|
@@ -67,6 +85,22 @@ export class Schedule {
|
|
|
67
85
|
}
|
|
68
86
|
return takeFromExternrefTable0(ret[0]);
|
|
69
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns occurrences starting after `from`, limited to `limit` results.
|
|
90
|
+
* Returns an array of datetime strings.
|
|
91
|
+
* @param {string} from
|
|
92
|
+
* @param {number} limit
|
|
93
|
+
* @returns {any}
|
|
94
|
+
*/
|
|
95
|
+
occurrences(from, limit) {
|
|
96
|
+
const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
97
|
+
const len0 = WASM_VECTOR_LEN;
|
|
98
|
+
const ret = wasm.schedule_occurrences(this.__wbg_ptr, ptr0, len0, limit);
|
|
99
|
+
if (ret[2]) {
|
|
100
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
101
|
+
}
|
|
102
|
+
return takeFromExternrefTable0(ret[0]);
|
|
103
|
+
}
|
|
70
104
|
/**
|
|
71
105
|
* Parse an hron expression string.
|
|
72
106
|
* @param {string} input
|
|
@@ -81,6 +115,25 @@ export class Schedule {
|
|
|
81
115
|
}
|
|
82
116
|
return Schedule.__wrap(ret[0]);
|
|
83
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Compute the most recent occurrence strictly before `now`.
|
|
120
|
+
* @param {string} now
|
|
121
|
+
* @returns {string | undefined}
|
|
122
|
+
*/
|
|
123
|
+
previousFrom(now) {
|
|
124
|
+
const ptr0 = passStringToWasm0(now, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
125
|
+
const len0 = WASM_VECTOR_LEN;
|
|
126
|
+
const ret = wasm.schedule_previousFrom(this.__wbg_ptr, ptr0, len0);
|
|
127
|
+
if (ret[3]) {
|
|
128
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
129
|
+
}
|
|
130
|
+
let v2;
|
|
131
|
+
if (ret[0] !== 0) {
|
|
132
|
+
v2 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
133
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
134
|
+
}
|
|
135
|
+
return v2;
|
|
136
|
+
}
|
|
84
137
|
/**
|
|
85
138
|
* Get the timezone, if specified.
|
|
86
139
|
* @returns {string | undefined}
|
package/hron_wasm_bg.wasm
CHANGED
|
Binary file
|