cronstrue 2.3.0 → 2.4.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/README.md +12 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,17 +99,19 @@ An options object can be passed as the second parameter to `cronstrue.toString`.
|
|
|
99
99
|
|
|
100
100
|
## i18n
|
|
101
101
|
|
|
102
|
-
To use the i18n support cRonstrue provides, you can either import all the supported locales at once (using `cronstrue/i18n`) or
|
|
102
|
+
To use the i18n support cRonstrue provides, you can either import all the supported locales at once (using `cronstrue/i18n`) or import individual locales (using `cronstrue/locales/[locale]`). Then, when calling `toString` you pass in the name of the locale you want to use. For example, for the es (Spanish) locale, you would use: `cronstrue.toString("* * * * *", { locale: "es" })`.
|
|
103
103
|
|
|
104
104
|
### All Locales
|
|
105
105
|
|
|
106
|
-
You can import all locales at once with `cronstrue/i18n`. This approach has the advantage of only having to load one module and having access to all supported locales. The tradeoff with this approach is a larger module that will take longer to load, particularly when sending down to a browser.
|
|
106
|
+
You can import all locales at once with `cronstrue/i18n`. This approach has the advantage of only having to load one module and having access to all supported locales. The tradeoff with this approach is a larger module (~130k, minified) that will take longer to load, particularly when sending down to a browser.
|
|
107
107
|
|
|
108
108
|
```js
|
|
109
|
-
// Node
|
|
109
|
+
// Node / CommonJS
|
|
110
110
|
const cronstrue = require('cronstrue/i18n');
|
|
111
|
-
|
|
111
|
+
|
|
112
|
+
// ESM / webpack / TypeScript
|
|
112
113
|
import cronstrue from 'cronstrue/i18n';
|
|
114
|
+
|
|
113
115
|
// Browser
|
|
114
116
|
<script src="https://unpkg.com/cronstrue@latest/cronstrue-i18n.min.js" async></script>
|
|
115
117
|
|
|
@@ -119,17 +121,19 @@ cronstrue.toString("*/5 * * * *", { locale: "es" }); // => Cada 5 minutos
|
|
|
119
121
|
|
|
120
122
|
### Individual Locales
|
|
121
123
|
|
|
122
|
-
You can also load the main cronstrue module and then load individual locale modules you want to have access to. This works well when you have one or more locales you know you need access to and want to minimize load time, particularly when sending down to a browser.
|
|
124
|
+
You can also load the main cronstrue module and then load individual locale modules you want to have access to. This works well when you have one or more locales you know you need access to and want to minimize load time, particularly when sending down to a browser. The main cronstrue module is about 42k (minified) and each locale is about 4k (minified) in size.
|
|
123
125
|
|
|
124
126
|
```js
|
|
125
|
-
// Node
|
|
127
|
+
// Node / CommonJS
|
|
126
128
|
const cronstrue = require('cronstrue');
|
|
127
129
|
require('cronstrue/locales/fr');
|
|
128
130
|
require('cronstrue/locales/es');
|
|
129
|
-
|
|
131
|
+
|
|
132
|
+
// ESM / webpack / TypeScript
|
|
130
133
|
import cronstrue from 'cronstrue';
|
|
131
134
|
import 'cronstrue/locales/fr';
|
|
132
135
|
import 'cronstrue/locales/es';
|
|
136
|
+
|
|
133
137
|
// Browser
|
|
134
138
|
<script src="https://unpkg.com/cronstrue@latest/cronstrue.min.js" async></script>
|
|
135
139
|
<script src="https://unpkg.com/cronstrue@latest/locales/fr.min.js" async></script>
|
|
@@ -147,7 +151,7 @@ This library does not do full validation of cron expressions and assumes the exp
|
|
|
147
151
|
|
|
148
152
|
> Can cRonstrue output the next occurrence of the cron expression?
|
|
149
153
|
|
|
150
|
-
No, cRonstrue does not support this.
|
|
154
|
+
No, cRonstrue does not support this. This library simply describes a cron expression that is passed in.
|
|
151
155
|
|
|
152
156
|
### Supported Locales
|
|
153
157
|
|