Comparing version 1.1.31 to 1.1.32
@@ -1,1 +0,1 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var r in s)("object"==typeof exports?exports:t)[r]=s[r]}}(this,(function(){return t={10:(t,e,s)=>{var r=s(407);t.exports=r},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,l=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>=l.length)&&s("Value out of range: '"+e+"'"),i>a&&s("From value is larger than to value: '"+e+"'"),n=i;n<=a;n++)l[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>l.length&&s("Syntax error, steps cannot be greater than maximum value of part ("+l.length+")"),n=0;n<l.length;n+=u)l[n+r]=1;else n=parseInt(e,10)+r,(n<0||n>=l.length)&&s(t+" value out of range: '"+e+"'"),l[n]=1;else for(n=0;n<l.length;n++)l[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}(10);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={10:(t,e,s)=>{var r=s(407);t.exports=r},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}(10).default;var t,e})); |
{ | ||
"name": "croner", | ||
"version": "1.1.31", | ||
"version": "1.1.32", | ||
"description": "Isomorphic JavaScript cron parser and scheduler.", | ||
@@ -5,0 +5,0 @@ "author": "Hexagon <github.com/hexagon>", |
@@ -13,3 +13,3 @@ # Croner | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/croner@1.1.31/dist/croner.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/croner@1.1.32/dist/croner.min.js"></script> | ||
``` | ||
@@ -39,3 +39,3 @@ | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/croner@1.1.31/dist/croner.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/croner@1.1.32/dist/croner.min.js"></script> | ||
``` | ||
@@ -74,3 +74,3 @@ | ||
<script type="module"> | ||
import Cron from 'https://cdn.jsdelivr.net/npm/croner@1.1.31/dist/croner.min.mjs'; | ||
import Cron from 'https://cdn.jsdelivr.net/npm/croner@1.1.32/dist/croner.min.mjs'; | ||
@@ -91,3 +91,3 @@ Cron('* * * * * *', () => { | ||
"imports": { | ||
"croner": "https://cdn.jsdelivr.net/npm/croner@1.1.31/dist/croner.min.mjs" | ||
"croner": "https://cdn.jsdelivr.net/npm/croner@1.1.32/dist/croner.min.mjs" | ||
} | ||
@@ -94,0 +94,0 @@ } |
/* ------------------------------------------------------------------------------------ | ||
Croner 1.1.31 - MIT License - Hexagon <github.com/Hexagon> | ||
Croner 1.1.32 - MIT License - Hexagon <github.com/Hexagon> | ||
@@ -5,0 +5,0 @@ Pure JavaScript Isomorphic cron parser and scheduler without dependencies. |
@@ -11,3 +11,5 @@ const | ||
filename: "croner.min.js", | ||
library: { type: "umd" }, | ||
library: "Cron", | ||
libraryTarget: "umd" , | ||
libraryExport: "default", | ||
globalObject: 'this' | ||
@@ -14,0 +16,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66908
1276