croner 5.2.0 → 5.2.1
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/README.md +44 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,45 +45,47 @@ More [examples](#examples)...
|
|
|
45
45
|
|
|
46
46
|
Because the existing ones aren't good enough. They have serious bugs, use bloated dependencies, do not work in all environments and/or simply don't work as expected.
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
| | croner | cronosjs | node-cron | cron | node-schedule |
|
|
49
|
+
|---------------------------|:-------------------:|:-------------------:|:---------:|:-------------------------:|:-------------------:|
|
|
50
|
+
| **Platforms** |
|
|
51
|
+
| Node.js (CommonJS) | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
52
|
+
| Browser (ESMCommonJS) | ✓ | ✓ | | | |
|
|
53
|
+
| Deno (ESM) | ✓ | | | | |
|
|
54
|
+
| **Features** |
|
|
55
|
+
| dom-AND-dow | ✓ | | | | |
|
|
56
|
+
| dom-OR-dow | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
57
|
+
| Next run | ✓ | ✓ | | ✓ | ✓ |
|
|
58
|
+
| Next n runs | ✓ | ✓ | | ✓ | |
|
|
59
|
+
| Timezone | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
60
|
+
| **Size** |
|
|
61
|
+
| Minified size (KB) | 15.5 | 16.3 | 16.5 | - | - |
|
|
62
|
+
| Bundlephobia minzip (KB) | 3.6 | 5.1 | 5.7 | 23.9 | 32.4 |
|
|
63
|
+
| Dependencies | 0 | 0 | 1 | 1 | 3 |
|
|
64
|
+
| **Popularity** |
|
|
65
|
+
| Downloads/week [^1] | 631K | 20K | 358K | 1240K | 766K |
|
|
66
|
+
| **Quality** |
|
|
67
|
+
| Issues [^1] | 0 | 2 | 118 :warning: | 119 :warning: | 133 :warning: |
|
|
68
|
+
| Code coverage | 99% | 98% | 100% | 81% | 94% |
|
|
69
|
+
| **Performance** |
|
|
70
|
+
| Ops/s `1 2 3 4 5 6` | ToDo | ToDo | ToDo | ToDo | ToDo |
|
|
71
|
+
| **Tests** | **8/8** | **7/8** | **0/8** [^4] :question: | **1/8** :warning: | **7/8** |
|
|
72
|
+
| Test `0 0 23 * * *` | 2022-10-09 00:40 | 2022-10-09 00:40 | N/A | 2022-10-09 00:40 | 2022-10-09 00:40 |
|
|
73
|
+
| Test `0 0 0 L 2 *` [^2] | 2023-02-28 00:00 | 2023-02-28 00:00 | N/A | N/A | 2023-02-28 00:00 |
|
|
74
|
+
| Test `0 0 0 29 2 *` | 2024-02-29 00:00 | 2024-02-29 00:00 | N/A | 2023-03-29 00:00 :x: | 2024-02-29 00:00 |
|
|
75
|
+
| Test `0 0 0 29 2 6` [^3] | 2048-02-09 00:00| N/A | N/A | N/A | N/A |
|
|
76
|
+
| Test `0 0 0 15 2 *` | 2023-02-16 00:00 | 2023-02-16 00:00 | N/A | 2023-03-15 00:00 :x: | 2023-02-16 00:00 |
|
|
77
|
+
| Test `0 0 0 * 10 1` | 2022-10-10 00:00 | 2022-10-10 00:00 | N/A | 2022-11-07 00:00 :x: | 2022-10-10 00:00 |
|
|
78
|
+
| Test `0 0 23 31 3 *` | 2023-03-31 23:00 | 2023-03-31 23:00 | N/A | 2023-04-01 23:00 :x: | 2023-03-31 23:00 |
|
|
79
|
+
| Test `1 2 3 4 5 6` | 2023-05-04 03:02 | 2023-05-04 03:02 | N/A | 2023-06-03 03:02 :x: | 2023-05-04 03:02 |
|
|
80
|
+
|
|
81
|
+
> **Note**
|
|
82
|
+
> Table last updated at 2022-10-08
|
|
83
|
+
|
|
84
|
+
[^1]: As of 2022-10-08
|
|
85
|
+
[^2]: Requires support for L-modifier
|
|
86
|
+
[^3]: In dom-AND-dow mode, only supported by croner at the moment.
|
|
87
|
+
[^4]: Node-cron has no way of showing next run time.
|
|
49
88
|
|
|
50
|
-
```
|
|
51
|
-
> node cron-implementation-test.js
|
|
52
|
-
|
|
53
|
-
Test: When is 23:00 next 31st march, pattern '0 0 23 31 3 *'
|
|
54
|
-
|
|
55
|
-
node-schedule: 2022-03-31 23:00:00 in 15.379ms
|
|
56
|
-
node-cron: ??? in 0.339ms
|
|
57
|
-
Month '3' is limited to '30' days.
|
|
58
|
-
cron: 2022-04-01 23:00:00 in 7.785ms
|
|
59
|
-
croner (legacy): 2022-03-31 23:00:00 in 2.142ms
|
|
60
|
-
croner (default): 2022-03-31 23:00:00 in 0.672ms
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
<details>
|
|
64
|
-
<summary>More test results</summary>
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
Test: When is next 15th of february, pattern '0 0 0 15 2 *'
|
|
68
|
-
|
|
69
|
-
node-schedule: 2023-02-15 00:00:00 in 43.875ms
|
|
70
|
-
node-cron: ??? in 2.217ms
|
|
71
|
-
cron: 2022-03-15 00:00:00 in 4.147ms
|
|
72
|
-
croner (legacy): 2023-02-15 00:00:00 in 1.72ms
|
|
73
|
-
croner (default): 2023-02-15 00:00:00 in 0.946ms
|
|
74
|
-
|
|
75
|
-
Test: When is next monday in october, pattern '0 0 0 * 10 1'
|
|
76
|
-
|
|
77
|
-
node-schedule: 2022-10-03 00:00:00 in 5.594ms
|
|
78
|
-
node-cron: ??? in 3.62ms
|
|
79
|
-
cron: 2022-11-07 00:00:00 in 1.658ms
|
|
80
|
-
croner (legacy): 2022-10-03 00:00:00 in 0.697ms
|
|
81
|
-
croner (default): 2022-10-03 00:00:00 in 0.546ms
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
</details>
|
|
85
|
-
|
|
86
|
-
https://gist.github.com/Hexagon/703f85f2dd86443cc17eef8f5cc6cb70
|
|
87
89
|
|
|
88
90
|
## Installation
|
|
89
91
|
|
|
@@ -120,7 +122,7 @@ const job : Cron = new Cron("* * * * * *", () => {
|
|
|
120
122
|
JavaScript
|
|
121
123
|
|
|
122
124
|
```javascript
|
|
123
|
-
import Cron from "https://deno.land/x/croner@5.1
|
|
125
|
+
import Cron from "https://deno.land/x/croner@5.2.1/src/croner.js";
|
|
124
126
|
|
|
125
127
|
Cron("* * * * * *", () => {
|
|
126
128
|
console.log("This will run every second.");
|
|
@@ -130,7 +132,7 @@ Cron("* * * * * *", () => {
|
|
|
130
132
|
TypeScript
|
|
131
133
|
|
|
132
134
|
```typescript
|
|
133
|
-
import { Cron } from "https://deno.land/x/croner@5.1
|
|
135
|
+
import { Cron } from "https://deno.land/x/croner@5.2.1/src/croner.js";
|
|
134
136
|
|
|
135
137
|
const _scheduler : Cron = new Cron("* * * * * *", () => {
|
|
136
138
|
console.log("This will run every second.");
|
|
@@ -243,7 +245,8 @@ The expressions of Croner are very similar to the ones of Vixie Cron, with a few
|
|
|
243
245
|
| Month | Yes | 1-12 or JAN-DEC| * , - / ? | |
|
|
244
246
|
| Day of Week | Yes | 0-7 or SUN-MON | * , - / ? | 0 to 6 are Sunday to Saturday<br>7 is Sunday, the same as 0 |
|
|
245
247
|
|
|
246
|
-
**Note
|
|
248
|
+
> **Note**
|
|
249
|
+
> Weekday and month names are case insensitive. Both MON and mon works.
|
|
247
250
|
|
|
248
251
|
It is also possible to use the following "nicknames" as pattern.
|
|
249
252
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "croner",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"description": "Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.",
|
|
5
5
|
"author": "Hexagon <github.com/hexagon>",
|
|
6
6
|
"homepage": "https://hexagon.github.io/croner",
|