Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

croner

Package Overview
Dependencies
Maintainers
1
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

croner - npm Package Compare versions

Comparing version 2.0.35 to 2.0.37

6

.eslintrc.json

@@ -11,6 +11,2 @@ {

],
"linebreak-style": [
2,
"windows"
],
"semi": [

@@ -24,2 +20,3 @@ 2,

],
"linebreak-style": 0,
"no-var": 1

@@ -30,2 +27,3 @@ },

},
"ignorePatterns": ["**/*.min.mjs", "**/*.min.js"],
"globals": {

@@ -32,0 +30,0 @@ "define": false,

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Cron=e():t.Cron=e()}(this,(function(){return t={407:t=>{const e=Math.pow(2,31)-1;function s(t){throw new TypeError("Cron parser: "+t)}function r(t,e){for(let s=0;s<t.length;s++)t[s]=e;return t}function n(t){this.milliseconds=t.getMilliseconds(),this.seconds=t.getSeconds(),this.minutes=t.getMinutes(),this.hours=t.getHours(),this.days=t.getDate(),this.months=t.getMonth(),this.years=t.getFullYear()}function o(t){this.pattern=t,this.seconds=r(Array(60),0),this.minutes=r(Array(60),0),this.hours=r(Array(24),0),this.days=r(Array(31),0),this.months=r(Array(12),0),this.daysOfWeek=r(Array(8),0),this.parse()}function i(t,e,s){let r=this;return this instanceof i?(r.pattern=new o(t),r.schedulerDefaults={stopAt:1/0,maxRuns:1/0,kill:!1},"function"==typeof e&&(s=e,e={}),r.opts=r.validateOpts(e||{}),void 0===s?r:this.schedule(e,s)):new i(t,e,s)}n.prototype.increment=function(t){this.seconds+=1,this.milliseconds=0;let e=this,s=function(t,s,r,n){for(let o=void 0===n?e[t]+r:0+r;o<s[t].length;o++)if(s[t][o])return e[t]=o-r,!0;return!1},r=[["seconds","minutes",0],["minutes","hours",0],["hours","days",0],["days","months",-1],["months","years",0]],n=0;for(;n<5;){if(!s(r[n][0],t,r[n][2]))for(this[r[n][1]]++;n>=0;)s(r[n][0],t,r[n][2],0),n--;n++}for(;!t.daysOfWeek[this.getDate().getDay()];)this.days+=1},n.prototype.getDate=function(){return new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds)},o.prototype.parse=function(){"string"!=typeof this.pattern&&this.pattern.constructor!==String&&s("Pattern has to be of type string.");let t,e,r,n,o,i=this.pattern.trim().replace(/\s+/g," ").split(" "),a=/[^/*0-9,-]+/;for(6!==i.length&&s("invalid configuration format ('"+this.pattern+"'), exacly five space separated parts required."),e=0;e<i.length;e++)t=i[e].trim(),a.test(t)&&s("configuration entry "+(e+1)+" ("+t+") contains illegal characters.");r="*"!==i[4],n="*"!==i[5],o="*"!==i[3],n&&(r||o)&&s("configuration invalid, you can not combine month/date with day of week."),this.partToArray("seconds",i[0],0),this.partToArray("minutes",i[1],0),this.partToArray("hours",i[2],0),this.partToArray("days",i[3],-1),this.partToArray("months",i[4],-1),this.partToArray("daysOfWeek",i[5],0),this.daysOfWeek[7]&&(this.daysOfWeek[0]=1)},o.prototype.partToArray=function(t,e,r){let n,o,i,a,u,p=this[t];if("*"!==e)if(o=e.split(","),o.length>1)for(n=0;n<o.length;n++)this.partToArray(t,o[n],r);else if(-1!==e.indexOf("-"))for(o=e.split("-"),2!==o.length&&s("Syntax error, illegal range: '"+e+"'"),i=parseInt(o[0],10)+r,a=parseInt(o[1],10)+r,isNaN(i)?s("Syntax error, illegal lower range (NaN)"):isNaN(a)&&s("Syntax error, illegal upper range (NaN)"),(i<0||a>=p.length)&&s("Value out of range: '"+e+"'"),i>a&&s("From value is larger than to value: '"+e+"'"),n=i;n<=a;n++)p[n+r]=1;else if(-1!==e.indexOf("/"))for(o=e.split("/"),2!==o.length&&s("Syntax error, illegal stepping: '"+e+"'"),"*"!==o[0]&&s("Syntax error, left part of / needs to be * : '"+e+"'"),u=parseInt(o[1],10),isNaN(u)&&s("Syntax error, illegal stepping: (NaN)"),0===u&&s("Syntax error, illegal stepping: 0"),u>p.length&&s("Syntax error, steps cannot be greater than maximum value of part ("+p.length+")"),n=0;n<p.length;n+=u)p[n+r]=1;else n=parseInt(e,10)+r,(n<0||n>=p.length)&&s(t+" value out of range: '"+e+"'"),p[n]=1;else for(n=0;n<p.length;n++)p[n]=1},i.prototype.next=function(t){let e=this._next(t);return e&&e.setMilliseconds(0),e},i.prototype.previous=function(){return this.opts.previous},i.prototype._next=function(t){if(t=t||new Date,this.opts.startAt&&t<this.opts.startAt&&(t=this.opts.startAt),this.opts.maxRuns<=0||this.opts.kill)return;let e,s=this.opts.stopAt||this.schedulerDefaults.stopAt,r=new n(t);return r.increment(this.pattern),e=r.getDate(),s&&e>=s?void 0:e},i.prototype.validateOpts=function(t){return t.startAt&&(t.startAt.constructor!==Date?t.startAt=new Date(Date.parse(t.startAt)-1):t.startAt=new Date(t.startAt.getTime()-1),isNaN(t.startAt)&&s("Provided value for startAt could not be parsed as date.")),t.stopAt&&(t.stopAt.constructor!==Date&&(t.stopAt=new Date(Date.parse(t.stopAt))),isNaN(t.stopAt)&&s("Provided value for stopAt could not be parsed as date.")),t},i.prototype.msToNext=function(t){t=t||new Date;let e=this._next(t);return e?this._next(t)-t.getTime():e},i.prototype.schedule=function(t,s){let r,n=this,o=n.maxDelay||e;if(s||(s=t,t={}),t.paused=void 0!==t.paused&&t.paused,t.kill=t.kill||this.schedulerDefaults.kill,t.rest=t.rest||0,t.maxRuns||0===t.maxRuns||(t.maxRuns=this.schedulerDefaults.maxRuns),n.opts=n.validateOpts(t||{}),r=this.msToNext(t.previous),void 0!==r)return r>o&&(r=o),t.currentTimeout=setTimeout((function(){r!==o&&(t.paused||(t.maxRuns--,s()),t.previous=new Date),n.schedule(t,s)}),r),{stop:function(){t.kill=!0,t.currentTimeout&&clearTimeout(t.currentTimeout)},pause:function(){return(t.paused=!0)&&!t.kill},resume:function(){return!(t.paused=!1)&&!t.kill}}},t.exports=i}},e={},function s(r){var n=e[r];if(void 0!==n)return n.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,s),o.exports}(407);var t,e}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Cron=e():t.Cron=e()}(this,(function(){return t={407:t=>{const e=Math.pow(2,31)-1;function s(t){throw new TypeError("Cron parser: "+t)}function r(t,e){for(let s=0;s<t.length;s++)t[s]=e;return t}function n(t){this.milliseconds=t.getMilliseconds(),this.seconds=t.getSeconds(),this.minutes=t.getMinutes(),this.hours=t.getHours(),this.days=t.getDate(),this.months=t.getMonth(),this.years=t.getFullYear()}function o(t){this.pattern=t,this.seconds=r(Array(60),0),this.minutes=r(Array(60),0),this.hours=r(Array(24),0),this.days=r(Array(31),0),this.months=r(Array(12),0),this.daysOfWeek=r(Array(8),0),this.parse()}function i(t,e,s){let r=this;return this instanceof i?(r.pattern=new o(t),r.schedulerDefaults={stopAt:1/0,maxRuns:1/0,kill:!1},"function"==typeof e&&(s=e,e={}),r.opts=r.validateOpts(e||{}),void 0===s?r:this.schedule(e,s)):new i(t,e,s)}n.prototype.increment=function(t){this.seconds+=1,this.milliseconds=0;let e=this,s=function(t,s,r,n){for(let o=void 0===n?e[t]+r:0+r;o<s[t].length;o++)if(s[t][o])return e[t]=o-r,!0;return!1},r=[["seconds","minutes",0],["minutes","hours",0],["hours","days",0],["days","months",-1],["months","years",0]],n=0;for(;n<5;){if(!s(r[n][0],t,r[n][2]))for(this[r[n][1]]++;n>=0;)s(r[n][0],t,r[n][2],0),n--;n++}for(;!t.daysOfWeek[this.getDate().getDay()];)this.days+=1},n.prototype.getDate=function(){return new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds)},o.prototype.parse=function(){"string"!=typeof this.pattern&&this.pattern.constructor!==String&&s("Pattern has to be of type string.");let t,e,r,n,o,i=this.pattern.trim().replace(/\s+/g," ").split(" "),a=/[^/*0-9,-]+/;for(6!==i.length&&s("invalid configuration format ('"+this.pattern+"'), exacly five space separated parts required."),e=0;e<i.length;e++)t=i[e].trim(),a.test(t)&&s("configuration entry "+(e+1)+" ("+t+") contains illegal characters.");r="*"!==i[4],n="*"!==i[5],o="*"!==i[3],n&&(r||o)&&s("configuration invalid, you can not combine month/date with day of week."),this.partToArray("seconds",i[0],0),this.partToArray("minutes",i[1],0),this.partToArray("hours",i[2],0),this.partToArray("days",i[3],-1),this.partToArray("months",i[4],-1),this.partToArray("daysOfWeek",i[5],0),this.daysOfWeek[7]&&(this.daysOfWeek[0]=1)},o.prototype.partToArray=function(t,e,r){let n,o,i,a,u,p=this[t];if("*"!==e)if(o=e.split(","),o.length>1)for(n=0;n<o.length;n++)this.partToArray(t,o[n],r);else if(-1!==e.indexOf("-"))for(o=e.split("-"),2!==o.length&&s("Syntax error, illegal range: '"+e+"'"),i=parseInt(o[0],10)+r,a=parseInt(o[1],10)+r,isNaN(i)?s("Syntax error, illegal lower range (NaN)"):isNaN(a)&&s("Syntax error, illegal upper range (NaN)"),(i<0||a>=p.length)&&s("Value out of range: '"+e+"'"),i>a&&s("From value is larger than to value: '"+e+"'"),n=i;n<=a;n++)p[n+r]=1;else if(-1!==e.indexOf("/"))for(o=e.split("/"),2!==o.length&&s("Syntax error, illegal stepping: '"+e+"'"),"*"!==o[0]&&s("Syntax error, left part of / needs to be * : '"+e+"'"),u=parseInt(o[1],10),isNaN(u)&&s("Syntax error, illegal stepping: (NaN)"),0===u&&s("Syntax error, illegal stepping: 0"),u>p.length&&s("Syntax error, steps cannot be greater than maximum value of part ("+p.length+")"),n=0;n<p.length;n+=u)p[n+r]=1;else n=parseInt(e,10)+r,(n<0||n>=p.length)&&s(t+" value out of range: '"+e+"'"),p[n]=1;else for(n=0;n<p.length;n++)p[n]=1},i.prototype.next=function(t){let e=this._next(t);return e&&e.setMilliseconds(0),e},i.prototype.previous=function(){return this.opts.previous},i.prototype._next=function(t){if(t=t||new Date,this.opts.startAt&&t<this.opts.startAt&&(t=this.opts.startAt),this.opts.maxRuns<=0||this.opts.kill)return;let e,s=this.opts.stopAt||this.schedulerDefaults.stopAt,r=new n(t);return r.increment(this.pattern),e=r.getDate(),s&&e>=s?void 0:e},i.prototype.validateOpts=function(t){return t.startAt&&(t.startAt.constructor!==Date?t.startAt=new Date(Date.parse(t.startAt)-1):t.startAt=new Date(t.startAt.getTime()-1),isNaN(t.startAt)&&s("Provided value for startAt could not be parsed as date.")),t.stopAt&&(t.stopAt.constructor!==Date&&(t.stopAt=new Date(Date.parse(t.stopAt))),isNaN(t.stopAt)&&s("Provided value for stopAt could not be parsed as date.")),t},i.prototype.msToNext=function(t){t=t||new Date;let e=this._next(t);return e?this._next(t)-t.getTime():e},i.prototype.schedule=function(t,s){let r,n=this,o=n.maxDelay||e;if(s||(s=t,t={}),t.paused=void 0!==t.paused&&t.paused,t.kill=t.kill||this.schedulerDefaults.kill,t.rest=t.rest||0,t.maxRuns||0===t.maxRuns||(t.maxRuns=this.schedulerDefaults.maxRuns),n.opts=n.validateOpts(t||{}),r=this.msToNext(t.previous),void 0!==r)return r>o&&(r=o),t.currentTimeout=setTimeout((function(){r!==o&&(t.paused||(t.maxRuns--,s()),t.previous=new Date),n.schedule(t,s)}),r),{stop:function(){t.kill=!0,t.currentTimeout&&clearTimeout(t.currentTimeout)},pause:function(){return(t.paused=!0)&&!t.kill},resume:function(){return!(t.paused=!1)&&!t.kill}}},t.exports=i,t.exports.default=i}},e={},function s(r){var n=e[r];if(void 0!==n)return n.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,s),o.exports}(407);var t,e}));
{
"name": "croner",
"version": "2.0.35",
"version": "2.0.37",
"description": "Isomorphic JavaScript cron parser and scheduler.",

@@ -30,4 +30,4 @@ "author": "Hexagon <github.com/hexagon>",

"test:mocha": "mocha",
"test:lint": "eslint src/croner.js",
"test:lint:fix": "eslint --fix src/croner.js",
"test:lint": "eslint ./**/*.js ./**/*.mjs",
"test:lint:fix": "eslint --fix ./**/*.js ./**/*.mjs",
"build": "npm run test:lint && npm run build:typings && npm run build:webpack && npm run test:mocha && npm run build:finalize",

@@ -34,0 +34,0 @@ "build:webpack": "webpack",

@@ -8,8 +8,6 @@ # Croner

Supports Node.js, requirejs, es-module and stand alone usage.
Documented with [JSDoc](https://jsdoc.app/) for intellisense, and include [TypeScript](https://www.typescriptlang.org/) typings.
Documented with JSDoc for intellisense, and complete TypeScript typings for type checking.
```html
<script src="https://cdn.jsdelivr.net/npm/croner@2/minified"></script>
<script src="https://cdn.jsdelivr.net/npm/croner@2/dist/croner.min.js"></script>
```

@@ -24,13 +22,12 @@

## Installation
# Installation
### Manual
## Manual
* Download latest [zipball](http://github.com/Hexagon/croner/zipball/master/)
* Unpack
* Grab ```croner.min.js``` ([UMD](https://github.com/umdjs/umd)) or ```croner.min.mjs``` ([ES-module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)) from the [dist/](/dist) folder
* Download latest [zipball](http://github.com/Hexagon/croner/zipball/master/)
* Unpack
* Grab croner.min.js or croner.min.mjs from the [dist/](/dist) folder
### Node.js
## Node.js
```npm install croner --save```

@@ -49,3 +46,3 @@

## CDN
### CDN

@@ -55,3 +52,3 @@ To use as a [UMD](https://github.com/umdjs/umd)-module (stand alone, [RequireJS](https://requirejs.org/) etc.)

```html
<script src="https://cdn.jsdelivr.net/npm/croner@2/minified"></script>
<script src="https://cdn.jsdelivr.net/npm/croner@2/dist/croner.min.js"></script>
```

@@ -63,3 +60,3 @@

<script type="module">
import Cron from "https://cdn.jsdelivr.net/npm/croner@2/minified";
import Cron from "https://cdn.jsdelivr.net/npm/croner@2/dist/croner.min.mjs";

@@ -75,3 +72,3 @@ // ... see usage section ...

"imports": {
"croner": "https://cdn.jsdelivr.net/npm/croner@2/minified"
"croner": "https://cdn.jsdelivr.net/npm/croner@2/dist/croner.min.mjs"
}

@@ -87,28 +84,6 @@ }

# Usage
## Examples
### Minimalist scheduling
```javascript
Cron('* * * * * *', () => {
console.log('This will run every second');
});
```
## Browser, require.js
Include by CDN, or include croner.min.js in your preferred way, it will register itself as a require.js module.
```javascript
define(["croner"], function(Cron) {
Cron('* * * * * *', function () {
console.log('This will run every second');
});
});
```
# Examples
## Minimalist scheduling
```javascript
// Run a function each second

@@ -120,3 +95,3 @@ Cron('* * * * * *', function () {

## Minimalist scheduling with stepping
### Minimalist scheduling with stepping
```javascript

@@ -129,3 +104,3 @@ // Run a function every fifth second

## Minimalist scheduling with range
### Minimalist scheduling with range
```javascript

@@ -138,3 +113,3 @@ // Run a function the first five seconds of a minute

## Minimalist scheduling with options
### Minimalist scheduling with options
```javascript

@@ -147,3 +122,3 @@ // Run a function each second, limit to five runs

## Minimalist scheduling with controls
### Minimalist scheduling with job controls
```javascript

@@ -166,3 +141,3 @@ // Run a function each second, get reference to job

## Basic scheduling
### Basic scheduling
```javascript

@@ -178,3 +153,3 @@

## Scheduling with options
### Scheduling with options
```javascript

@@ -190,3 +165,3 @@

```
## Scheduling with controls
### Scheduling with job controls
```javascript

@@ -212,7 +187,8 @@

# Full API
## Full API
```javascript
var o = Cron( <string pattern> [, <object options>] [, <function callback> ] );
```
```javascript
// If Cron is initialized without a scheduled function, cron itself is returned

@@ -235,6 +211,5 @@ // and the following member functions is available.

## Pattern
# Pattern
```
```javascript
┌──────────────── second (0 - 59)

@@ -251,6 +226,4 @@ │ ┌────────────── minute (0 - 59)

## License
# License
MIT
MIT
var should = require("should");
let should = require("should");
module.exports = function (Cron) {
describe("Module", function () {
describe("Module", function () {
it("new Cron(...) should not throw", function () {
(function(){
var scheduler = new Cron("* * * * * *");
scheduler.next();
}).should.not.throw();
});
it("new Cron(...) should not throw", function () {
(function(){
let scheduler = new Cron("* * * * * *");
scheduler.next();
}).should.not.throw();
});
it("cron(...) without `new` should not throw", function () {
(function(){
var scheduler = Cron("* * * * * *");
scheduler.next();
}).should.not.throw();
});
it("cron(...) without `new` should not throw", function () {
(function(){
let scheduler = Cron("* * * * * *");
scheduler.next();
}).should.not.throw();
});
});
});
describe("Parser", function () {
describe("Parser", function () {
it("Clean pattern should not throw", function () {
(function(){
var scheduler = new Cron("* * * * * *");
scheduler.next();
}).should.not.throw();
});
it("Clean pattern should not throw", function () {
(function(){
let scheduler = new Cron("* * * * * *");
scheduler.next();
}).should.not.throw();
});
it("String object pattern should not throw", function () {
(function(){
var scheduler = new Cron(new String("* * * * * *"));
scheduler.next();
}).should.not.throw();
});
it("String object pattern should not throw", function () {
(function(){
let scheduler = new Cron(new String("* * * * * *"));
scheduler.next();
}).should.not.throw();
});
it("Short pattern should throw", function () {
(function(){
var scheduler = new Cron("* * * * *");
scheduler.next();
}).should.throw();
});
it("Short pattern should throw", function () {
(function(){
let scheduler = new Cron("* * * * *");
scheduler.next();
}).should.throw();
});
it("Long pattern should throw", function () {
(function(){
var scheduler = new Cron("* * * * * * *");
scheduler.next();
}).should.throw();
});
it("Long pattern should throw", function () {
(function(){
let scheduler = new Cron("* * * * * * *");
scheduler.next();
}).should.throw();
});
it("Letter in pattern should throw", function () {
(function(){
var scheduler = new Cron("* a * * * *");
scheduler.next();
}).should.throw();
});
it("Letter in pattern should throw", function () {
(function(){
let scheduler = new Cron("* a * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern should not throw", function () {
(function(){
var scheduler = new Cron("* */5 * * * *");
scheduler.next();
}).should.not.throw();
});
it("Slash in pattern should not throw", function () {
(function(){
let scheduler = new Cron("* */5 * * * *");
scheduler.next();
}).should.not.throw();
});
it("Slash in pattern with number first should throw", function () {
(function(){
var scheduler = new Cron("* 5/* * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with number first should throw", function () {
(function(){
let scheduler = new Cron("* 5/* * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern without following number should throw", function () {
(function(){
var scheduler = new Cron("* */ * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern without following number should throw", function () {
(function(){
let scheduler = new Cron("* */ * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with preceding number should throw", function () {
(function(){
var scheduler = new Cron("* 1/5 * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with preceding number should throw", function () {
(function(){
let scheduler = new Cron("* 1/5 * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with wildcards both pre and post should throw", function () {
(function(){
var scheduler = new Cron("* */* * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with wildcards both pre and post should throw", function () {
(function(){
let scheduler = new Cron("* */* * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with zero stepping should throw", function () {
(function(){
var scheduler = new Cron("* */0 * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with zero stepping should throw", function () {
(function(){
let scheduler = new Cron("* */0 * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with letter after should throw should throw", function () {
(function(){
var scheduler = new Cron("* */a * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with letter after should throw should throw", function () {
(function(){
let scheduler = new Cron("* */a * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with too high stepping should throw", function () {
(function(){
var scheduler = new Cron("* */61 * * * *");
scheduler.next();
}).should.throw();
});
it("Slash in pattern with too high stepping should throw", function () {
(function(){
let scheduler = new Cron("* */61 * * * *");
scheduler.next();
}).should.throw();
});
it("Missing lower range should throw", function () {
(function(){
var scheduler = new Cron("* -9 * * * *");
scheduler.next();
}).should.throw();
});
it("Missing lower range should throw", function () {
(function(){
let scheduler = new Cron("* -9 * * * *");
scheduler.next();
}).should.throw();
});
it("Missing upper range should throw", function () {
(function(){
var scheduler = new Cron("* 0- * * * *");
scheduler.next();
}).should.throw();
});
it("Missing upper range should throw", function () {
(function(){
let scheduler = new Cron("* 0- * * * *");
scheduler.next();
}).should.throw();
});
it("Valid range should not throw", function () {
(function(){
var scheduler = new Cron("* 0-9 * * * *");
scheduler.next();
}).should.not.throw();
});
it("Valid range should not throw", function () {
(function(){
let scheduler = new Cron("* 0-9 * * * *");
scheduler.next();
}).should.not.throw();
});
it("Valid seconds should not throw", function () {
(function(){
var scheduler = new Cron("0-59 * * * * *");
scheduler.next();
}).should.not.throw();
});
it("Valid seconds should not throw", function () {
(function(){
let scheduler = new Cron("0-59 * * * * *");
scheduler.next();
}).should.not.throw();
});
it("Too high second should throw", function () {
(function(){
var scheduler = new Cron("0-60 * * * * *");
scheduler.next();
}).should.throw();
});
it("Too high second should throw", function () {
(function(){
let scheduler = new Cron("0-60 * * * * *");
scheduler.next();
}).should.throw();
});
it("Valid minutes should not throw", function () {
(function(){
var scheduler = new Cron("* 0-59 * * * *");
scheduler.next();
}).should.not.throw();
});
it("Valid minutes should not throw", function () {
(function(){
let scheduler = new Cron("* 0-59 * * * *");
scheduler.next();
}).should.not.throw();
});
it("Too high minute should throw", function () {
(function(){
var scheduler = new Cron("* 0-5,55,60 * * * *");
scheduler.next();
}).should.throw();
});
it("Too high minute should throw", function () {
(function(){
let scheduler = new Cron("* 0-5,55,60 * * * *");
scheduler.next();
}).should.throw();
});
it("Valid hours should not throw", function () {
(function(){
var scheduler = new Cron("* * 0-23 * * *");
scheduler.next();
}).should.not.throw();
});
it("Valid hours should not throw", function () {
(function(){
let scheduler = new Cron("* * 0-23 * * *");
scheduler.next();
}).should.not.throw();
});
it("Too high hours minute should throw", function () {
(function(){
var scheduler = new Cron("* * 0,23,24 * * *");
scheduler.next();
}).should.throw();
});
it("Too high hours minute should throw", function () {
(function(){
let scheduler = new Cron("* * 0,23,24 * * *");
scheduler.next();
}).should.throw();
});
it("Valid days should not throw", function () {
(function(){
var scheduler = new Cron("* * * 1-31 * *");
scheduler.next();
}).should.not.throw();
});
it("Valid days should not throw", function () {
(function(){
let scheduler = new Cron("* * * 1-31 * *");
scheduler.next();
}).should.not.throw();
});
it("Too high days should throw", function () {
(function(){
var scheduler = new Cron("* * * 32 * *");
scheduler.next();
}).should.throw();
});
it("Too high days should throw", function () {
(function(){
let scheduler = new Cron("* * * 32 * *");
scheduler.next();
}).should.throw();
});
it("Too low days should throw", function () {
(function(){
var scheduler = new Cron("* * * 0 * *");
scheduler.next();
}).should.throw();
});
it("Too low days should throw", function () {
(function(){
let scheduler = new Cron("* * * 0 * *");
scheduler.next();
}).should.throw();
});
it("Valid months should not throw", function () {
(function(){
var scheduler = new Cron("* * * * 1,2,3,4,5,6,7,8,9,10,11,12 *");
scheduler.next();
}).should.not.throw();
});
it("Valid months should not throw", function () {
(function(){
let scheduler = new Cron("* * * * 1,2,3,4,5,6,7,8,9,10,11,12 *");
scheduler.next();
}).should.not.throw();
});
it("Too high months should throw", function () {
(function(){
var scheduler = new Cron("* * * * 7-13 *");
scheduler.next();
}).should.throw();
});
it("Too high months should throw", function () {
(function(){
let scheduler = new Cron("* * * * 7-13 *");
scheduler.next();
}).should.throw();
});
it("Too low months should throw", function () {
(function(){
var scheduler = new Cron("* * * * 0-3 *");
scheduler.next();
}).should.throw();
});
it("Too low months should throw", function () {
(function(){
let scheduler = new Cron("* * * * 0-3 *");
scheduler.next();
}).should.throw();
});
it("Valid weekdays should not throw", function () {
(function(){
var scheduler = new Cron("* * * * * 0,1,2,3,4,5,6,7");
scheduler.next();
}).should.not.throw();
});
it("Valid weekdays should not throw", function () {
(function(){
let scheduler = new Cron("* * * * * 0,1,2,3,4,5,6,7");
scheduler.next();
}).should.not.throw();
});
it("Too high weekday should throw", function () {
(function(){
var scheduler = new Cron("* * * * * 8");
scheduler.next();
}).should.throw();
});
it("Too high weekday should throw", function () {
(function(){
let scheduler = new Cron("* * * * * 8");
scheduler.next();
}).should.throw();
});
it("Too low weekday should throw", function () {
(function(){
var scheduler = new Cron("* * * * * -1");
scheduler.next();
}).should.throw();
});
it("Too low weekday should throw", function () {
(function(){
let scheduler = new Cron("* * * * * -1");
scheduler.next();
}).should.throw();
});
});
});
describe("Scheduler", function () {
describe("Scheduler", function () {
it("0 0 0 * * * should return tomorrow, at 00:00:00", function () {
var scheduler = new Cron("0 0 0 * * *"),
nextRun = scheduler.next(),
it("0 0 0 * * * should return tomorrow, at 00:00:00", function () {
let scheduler = new Cron("0 0 0 * * *"),
nextRun = scheduler.next(),
// ToDay/nextDay is a fix for DST in test
toDay = new Date(),
nextDay = new Date(new Date().getTime()+24*60*60*1000); // Add one day
// ToDay/nextDay is a fix for DST in test
toDay = new Date(),
nextDay = new Date(new Date().getTime()+24*60*60*1000); // Add one day
// Set seconds, minutes and hours to 00:00:00
toDay.setMilliseconds(0);
toDay.setSeconds(0);
toDay.setMinutes(0);
toDay.setHours(0);
nextDay = new Date(toDay.getTime()+36*60*60*1000);
nextDay.setMilliseconds(0);
nextDay.setSeconds(0);
nextDay.setMinutes(0);
nextDay.setHours(0);
// Set seconds, minutes and hours to 00:00:00
toDay.setMilliseconds(0);
toDay.setSeconds(0);
toDay.setMinutes(0);
toDay.setHours(0);
nextDay = new Date(toDay.getTime()+36*60*60*1000);
nextDay.setMilliseconds(0);
nextDay.setSeconds(0);
nextDay.setMinutes(0);
nextDay.setHours(0);
// Do comparison
nextRun.getTime().should.equal(nextDay.getTime());
// Do comparison
nextRun.getTime().should.equal(nextDay.getTime());
});
});
it("new String(\"0 0 0 * * *\") should return tomorrow, at 00:00:00", function () {
var scheduler = new Cron(new String("0 0 0 * * *")),
nextRun = scheduler.next(),
it("new String(\"0 0 0 * * *\") should return tomorrow, at 00:00:00", function () {
let scheduler = new Cron(new String("0 0 0 * * *")),
nextRun = scheduler.next(),
// ToDay/nextDay is a fix for DST in test
toDay = new Date(),
nextDay = new Date(new Date().getTime()+24*60*60*1000); // Add one day
// ToDay/nextDay is a fix for DST in test
toDay = new Date(),
nextDay = new Date(new Date().getTime()+24*60*60*1000); // Add one day
// Set seconds, minutes and hours to 00:00:00
toDay.setMilliseconds(0);
toDay.setSeconds(0);
toDay.setMinutes(0);
toDay.setHours(0);
nextDay = new Date(toDay.getTime()+36*60*60*1000);
nextDay.setMilliseconds(0);
nextDay.setSeconds(0);
nextDay.setMinutes(0);
nextDay.setHours(0);
// Set seconds, minutes and hours to 00:00:00
toDay.setMilliseconds(0);
toDay.setSeconds(0);
toDay.setMinutes(0);
toDay.setHours(0);
nextDay = new Date(toDay.getTime()+36*60*60*1000);
nextDay.setMilliseconds(0);
nextDay.setSeconds(0);
nextDay.setMinutes(0);
nextDay.setHours(0);
// Do comparison
nextRun.getTime().should.equal(nextDay.getTime());
// Do comparison
nextRun.getTime().should.equal(nextDay.getTime());
});
});
it("0 0 12 * * * with startdate tomorrow should return day after tomorrow, at 12:00:00", function () {
var
nextDay = new Date(new Date().getTime()+24*60*60*1000), // Add one day
dayAfterNext = new Date(new Date().getTime()+48*60*60*1000),// Add two days
scheduler,
nextRun;
it("0 0 12 * * * with startdate tomorrow should return day after tomorrow, at 12:00:00", function () {
let
nextDay = new Date(new Date().getTime()+24*60*60*1000), // Add one day
dayAfterNext = new Date(new Date().getTime()+48*60*60*1000),// Add two days
scheduler,
nextRun;
// Set a fixed hour later than startAt, to be sure that the days doesn't overlap
nextDay = new Date(nextDay.setHours(13));
dayAfterNext = new Date(dayAfterNext.setHours(13));
// Set a fixed hour later than startAt, to be sure that the days doesn't overlap
nextDay = new Date(nextDay.setHours(13));
dayAfterNext = new Date(dayAfterNext.setHours(13));
scheduler = new Cron("0 0 12 * * *", { startAt: nextDay });
nextRun = scheduler.next();
scheduler = new Cron("0 0 12 * * *", { startAt: nextDay });
nextRun = scheduler.next();
// Set seconds, minutes and hours to 00:00:00
dayAfterNext.setMilliseconds(0);
dayAfterNext.setSeconds(0);
dayAfterNext.setMinutes(0);
dayAfterNext.setHours(12);
// Set seconds, minutes and hours to 00:00:00
dayAfterNext.setMilliseconds(0);
dayAfterNext.setSeconds(0);
dayAfterNext.setMinutes(0);
dayAfterNext.setHours(12);
// Do comparison
nextRun.getTime().should.equal(dayAfterNext.getTime());
// Do comparison
nextRun.getTime().should.equal(dayAfterNext.getTime());
});
});
it("0 0 0 * * * with startdate yesterday should return tomorrow, at 12:00:00", function () {
var
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
nextDay = new Date(new Date().getTime()+24*60*60*1000),// Add two days
scheduler,
nextRun;
it("0 0 0 * * * with startdate yesterday should return tomorrow, at 12:00:00", function () {
let
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
nextDay = new Date(new Date().getTime()+24*60*60*1000),// Add two days
scheduler,
nextRun;
// Set a fixed hour later than startAt, to be sure that the days doesn't overlap
dayBefore = new Date(dayBefore.setHours(0));
nextDay = new Date(nextDay.setHours(0));
// Set a fixed hour later than startAt, to be sure that the days doesn't overlap
dayBefore = new Date(dayBefore.setHours(0));
nextDay = new Date(nextDay.setHours(0));
scheduler = new Cron("0 0 0 * * *", { startAt: dayBefore });
nextRun = scheduler.next();
scheduler = new Cron("0 0 0 * * *", { startAt: dayBefore });
nextRun = scheduler.next();
// Set seconds, minutes and hours to 00:00:00
nextDay.setMilliseconds(0);
nextDay.setSeconds(0);
nextDay.setMinutes(0);
nextDay.setHours(0);
// Set seconds, minutes and hours to 00:00:00
nextDay.setMilliseconds(0);
nextDay.setSeconds(0);
nextDay.setMinutes(0);
nextDay.setHours(0);
// Do comparison
nextRun.getTime().should.equal(nextDay.getTime());
// Do comparison
nextRun.getTime().should.equal(nextDay.getTime());
});
});
it("0 0 12 * * * with stopdate yesterday should return undefined", function () {
var
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
scheduler = new Cron("0 0 12 * * *", { stopAt: dayBefore }),
nextRun = scheduler.next();
it("0 0 12 * * * with stopdate yesterday should return undefined", function () {
let
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
scheduler = new Cron("0 0 12 * * *", { stopAt: dayBefore }),
nextRun = scheduler.next();
// Do comparison
should.equal(nextRun, void 0);
// Do comparison
should.equal(nextRun, void 0);
});
});
it("* * * * * * with maxRuns: 1 should return undefined after 1.5 seconds", function (done) {
var
scheduler = new Cron("* * * * * *"),
job = scheduler.schedule({ maxRuns: 1 }, function () {});
setTimeout(function () {
var nextRun = scheduler.next();
// Do comparison
should.equal(nextRun, void 0);
done();
},1500);
it("* * * * * * with maxRuns: 1 should return undefined after 1.5 seconds", function (done) {
let
scheduler = new Cron("* * * * * *");
scheduler.schedule({ maxRuns: 1 }, function () {});
setTimeout(function () {
let nextRun = scheduler.next();
// Do comparison
should.equal(nextRun, void 0);
done();
},1500);
});
});
it("0 0 0 * * * with 40 iterations should return 40 days from now", function () {
var scheduler = new Cron("0 0 0 * * *"),
prevRun = new Date(),
nextRun,
iterations = 40,
compareDay = new Date(new Date().getTime()+40*24*60*60*1000); // Add one day
it("0 0 0 * * * with 40 iterations should return 40 days from now", function () {
let scheduler = new Cron("0 0 0 * * *"),
prevRun = new Date(),
nextRun,
iterations = 40,
compareDay = new Date(new Date().getTime()+40*24*60*60*1000); // Add one day
while(iterations-->0) {
nextRun = scheduler.next(prevRun),
prevRun = nextRun;
}
while(iterations-->0) {
nextRun = scheduler.next(prevRun),
prevRun = nextRun;
}
// Set seconds, minutes and hours to 00:00:00
compareDay.setMilliseconds(0);
compareDay.setSeconds(0);
compareDay.setMinutes(0);
compareDay.setHours(0);
// Set seconds, minutes and hours to 00:00:00
compareDay.setMilliseconds(0);
compareDay.setSeconds(0);
compareDay.setMinutes(0);
compareDay.setHours(0);
// Do comparison
nextRun.getTime().should.equal(compareDay.getTime());
// Do comparison
nextRun.getTime().should.equal(compareDay.getTime());
});
});
it("0 * * * * * with 40 iterations should return 45 minutes from now", function () {
var scheduler = new Cron("0 * * * * *"),
prevRun = new Date(),
nextRun,
iterations = 45,
compareDay = new Date(new Date().getTime()+45*60*1000);
it("0 * * * * * with 40 iterations should return 45 minutes from now", function () {
let scheduler = new Cron("0 * * * * *"),
prevRun = new Date(),
nextRun,
iterations = 45,
compareDay = new Date(new Date().getTime()+45*60*1000);
while(iterations-->0) {
nextRun = scheduler.next(prevRun),
prevRun = nextRun;
}
while(iterations-->0) {
nextRun = scheduler.next(prevRun),
prevRun = nextRun;
}
// Set seconds, minutes and hours to 00:00:00
compareDay.setMilliseconds(0);
compareDay.setSeconds(0);
// Set seconds, minutes and hours to 00:00:00
compareDay.setMilliseconds(0);
compareDay.setSeconds(0);
// Do comparison
nextRun.getTime().should.equal(compareDay.getTime());
// Do comparison
nextRun.getTime().should.equal(compareDay.getTime());
});
});
it("Valid startAt with Date should not throw", function () {
(function () {
var
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
scheduler = new Cron("0 0 12 * * *", { startAt: dayBefore }),
nextRun = scheduler.next();
}).should.not.throw();
});
it("Valid startAt with Date should not throw", function () {
(function () {
let
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
scheduler = new Cron("0 0 12 * * *", { startAt: dayBefore });
scheduler.next();
}).should.not.throw();
});
it("Valid startAt with DateTime string should not throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { startAt: "2016-12-01 00:00:00" }),
nextRun = scheduler.next();
}).should.not.throw();
});
it("Valid startAt with DateTime string should not throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { startAt: "2016-12-01 00:00:00" });
scheduler.next();
}).should.not.throw();
});
it("Valid startAt with Date string should not throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { startAt: "2016-12-01" }),
nextRun = scheduler.next();
}).should.not.throw();
});
it("Valid startAt with Date string should not throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { startAt: "2016-12-01" });
scheduler.next();
}).should.not.throw();
});
it("Invalid startat should throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { startAt: "hellu throw" }),
nextRun = scheduler.next();
}).should.throw();
});
it("Invalid startat should throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { startAt: "hellu throw" });
scheduler.next();
}).should.throw();
});
it("startAt with time only should throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { startAt: "00:35:00" }),
nextRun = scheduler.next();
}).should.throw();
});
it("startAt with time only should throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { startAt: "00:35:00" });
scheduler.next();
}).should.throw();
});
it("Valid stopAt with Date should not throw", function () {
(function () {
var
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
scheduler = new Cron("0 0 12 * * *", { stopAt: dayBefore }),
nextRun = scheduler.next();
}).should.not.throw();
});
it("Valid stopAt with Date should not throw", function () {
(function () {
let
dayBefore = new Date(new Date().getTime()-24*60*60*1000), // Subtract one day
scheduler = new Cron("0 0 12 * * *", { stopAt: dayBefore });
scheduler.next();
}).should.not.throw();
});
it("Valid stopAt with DateTime string should not throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { stopAt: "2016-12-01 00:00:00" }),
nextRun = scheduler.next();
}).should.not.throw();
});
it("Valid stopAt with DateTime string should not throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { stopAt: "2016-12-01 00:00:00" });
scheduler.next();
}).should.not.throw();
});
it("Valid stopAt with Date string should not throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { stopAt: "2016-12-01" }),
nextRun = scheduler.next();
}).should.not.throw();
});
it("Valid stopAt with Date string should not throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { stopAt: "2016-12-01" });
scheduler.next();
}).should.not.throw();
});
it("Invalid stopAt should throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { stopAt: "hellu throw" }),
nextRun = scheduler.next();
}).should.throw();
});
it("Invalid stopAt should throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { stopAt: "hellu throw" });
scheduler.next();
}).should.throw();
});
it("stopAt with time only should throw", function () {
(function () {
var
scheduler = new Cron("0 0 12 * * *", { stopAt: "00:35:00" }),
nextRun = scheduler.next();
}).should.throw();
});
it("stopAt with time only should throw", function () {
(function () {
let
scheduler = new Cron("0 0 12 * * *", { stopAt: "00:35:00" });
scheduler.next();
}).should.throw();
});
it("Weekday 0 (sunday) and weekday 7 (sunday) should both be valid patterns", function () {
(function () {
var
scheduler0 = new Cron("0 0 0 * * 0"),
nextRun0 = scheduler0.next(),
scheduler7 = new Cron("0 0 0 * * 7"),
nextRun7 = scheduler7.next();
}).should.not.throw();
});
it("Weekday 0 (sunday) and weekday 7 (sunday) should both be valid patterns", function () {
(function () {
let
scheduler0 = new Cron("0 0 0 * * 0");
scheduler0.next();
let
scheduler7 = new Cron("0 0 0 * * 7");
scheduler7.next();
}).should.not.throw();
});
it("Weekday 0 (sunday) and weekday 7 (sunday) should give the same run time", function () {
var
scheduler0 = new Cron("0 0 0 * * 0"),
scheduler7 = new Cron("0 0 0 * * 7"),
nextRun0 = scheduler0.next(),
nextRun7 = scheduler7.next();
nextRun0.getTime().should.equal(nextRun7.getTime());
});
it("Weekday 0 (sunday) and weekday 7 (sunday) should give the same run time", function () {
let
scheduler0 = new Cron("0 0 0 * * 0"),
scheduler7 = new Cron("0 0 0 * * 7"),
nextRun0 = scheduler0.next(),
nextRun7 = scheduler7.next();
nextRun0.getTime().should.equal(nextRun7.getTime());
});
});
});
describe("Comprehensive testing ( will fail first day of the year)", function () {
it("Test milliseconds to 01:01:91 XXXX-01-01 (most often next year), 1000s steps", function () {
describe("Comprehensive testing ( will fail first day of the year)", function () {
it("Test milliseconds to 01:01:91 XXXX-01-01 (most often next year), 1000s steps", function () {
var prevRun = new Date(new Date().setMilliseconds(0)),
target = new Date(new Date((prevRun.getFullYear()+1) + "-01-01 01:01:01").getTime()),
scheduler = new Cron("1 1 1 1 1 *"),
nextRun,
left,
diff;
let prevRun = new Date(new Date().setMilliseconds(0)),
target = new Date(new Date((prevRun.getFullYear()+1) + "-01-01 01:01:01").getTime()),
scheduler = new Cron("1 1 1 1 1 *"),
left,
diff;
target.getTime().should.equal(scheduler.next().getTime());
target.getTime().should.equal(scheduler.next().getTime());
if(target.getTime() === scheduler.next().getTime()) {
while(prevRun < target) {
left = scheduler.msToNext(prevRun);
diff = Math.abs((target.getTime() - prevRun.getTime())-left);
diff.should.be.below(1001);
diff.should.be.above(-1);
prevRun = new Date(prevRun.getTime() + 1000000);
}
}
if(target.getTime() === scheduler.next().getTime()) {
while(prevRun < target) {
left = scheduler.msToNext(prevRun);
diff = Math.abs((target.getTime() - prevRun.getTime())-left);
diff.should.be.below(1001);
diff.should.be.above(-1);
prevRun = new Date(prevRun.getTime() + 1000000);
}
}
});
it("Test milliseconds to 23:59:59 XXXX-01-01 (most often next year), 1000s steps", function () {
});
it("Test milliseconds to 23:59:59 XXXX-01-01 (most often next year), 1000s steps", function () {
var prevRun = new Date(new Date().setMilliseconds(0)),
target = new Date(new Date((prevRun.getFullYear()+1) + "-01-01 23:59:59").getTime()),
scheduler = new Cron("59 59 23 1 1 *"),
nextRun,
left,
diff;
let prevRun = new Date(new Date().setMilliseconds(0)),
target = new Date(new Date((prevRun.getFullYear()+1) + "-01-01 23:59:59").getTime()),
scheduler = new Cron("59 59 23 1 1 *"),
left,
diff;
target.getTime().should.equal(scheduler.next().getTime());
target.getTime().should.equal(scheduler.next().getTime());
if(target.getTime() === scheduler.next().getTime()) {
while(prevRun < target) {
left = scheduler.msToNext(prevRun);
diff = Math.abs((target.getTime() - prevRun.getTime())-left);
diff.should.be.below(1001);
diff.should.be.above(-1);
prevRun = new Date(prevRun.getTime() + 1000000);
}
}
if(target.getTime() === scheduler.next().getTime()) {
while(prevRun < target) {
left = scheduler.msToNext(prevRun);
diff = Math.abs((target.getTime() - prevRun.getTime())-left);
diff.should.be.below(1001);
diff.should.be.above(-1);
prevRun = new Date(prevRun.getTime() + 1000000);
}
}
});
});
});
});
};

@@ -28,5 +28,6 @@ /*

"use strict";
const Cron = require("../dist/croner.min.js"),
test = require("./suite.js");
const
Cron = require("../dist/croner.min.js"),
test = require("./suite.js");
test(Cron);

@@ -74,3 +74,3 @@ export = Cron;

declare namespace Cron {
export { CronPatternPart, CronIndexOffset, CronNextResult, CronOptions, CronJobStop, CronJobResume, CronJob };
export { Cron as default, CronPatternPart, CronIndexOffset, CronNextResult, CronOptions, CronJobStop, CronJobResume, CronJob };
}

@@ -77,0 +77,0 @@ /**

const
path = require('path');
path = require("path");
module.exports = [
{
mode: 'production',
entry: "./src/croner.js",
output: {
path: path.join(__dirname, "dist"),
filename: "croner.min.js",
library: {
name: "Cron",
type: "umd"
},
globalObject: 'this'
}
},
{
mode: 'production',
entry: "./esm/croner.mjs",
output: {
path: path.join(__dirname, "dist"),
filename: "croner.min.mjs",
library: {
type: "module"
}
},
experiments: {
outputModule: true
}
}
{
mode: "production",
entry: "./src/croner.js",
output: {
path: path.join(__dirname, "dist"),
filename: "croner.min.js",
library: {
name: "Cron",
type: "umd"
},
globalObject: "this"
}
},
{
mode: "production",
entry: "./esm/croner.mjs",
output: {
path: path.join(__dirname, "dist"),
filename: "croner.min.mjs",
library: {
type: "module"
}
},
experiments: {
outputModule: true
}
}
];

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc