New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-schedule

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-schedule - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

fff.js

46

lib/schedule.js

@@ -96,3 +96,3 @@

if (reschedule && inv.recurrenceRule.recurs) {
newInv = scheduleNextRecurrence(inv.recurrenceRule, this, inv.fireDate);
newInv = scheduleNextRecurrence(inv.recurrenceRule, this, inv.fireDate, inv.endDate);
if (newInv !== null) {

@@ -132,3 +132,3 @@ newInvs.push(newInv);

if (reschedule && nextInv.recurrenceRule.recurs) {
newInv = scheduleNextRecurrence(nextInv.recurrenceRule, this, nextInv.fireDate);
newInv = scheduleNextRecurrence(nextInv.recurrenceRule, this, nextInv.fireDate, nextInv.endDate);
if (newInv !== null) {

@@ -191,5 +191,27 @@ this.trackInvocation(newInv);

var inv;
var start;
var end;
if (typeof spec === 'object' && spec.rule) {
start = spec.start || null;
end = spec.end || null;
spec = spec.rule;
if (start != null) {
if (!(start instanceof Date)) {
start = new Date(start);
}
if (!isValidDate(start) || start.getTime() < Date.now()) {
start = null;
}
}
if (end != null && !(end instanceof Date) && !isValidDate(end = new Date(end))) {
end = null;
}
}
try {
var res = cronParser.parseExpression(spec);
inv = scheduleNextRecurrence(res, self);
var res = cronParser.parseExpression(spec, { currentDate: start });
inv = scheduleNextRecurrence(res, self, start, end);
if (inv !== null) {

@@ -239,3 +261,3 @@ success = self.trackInvocation(inv);

inv = scheduleNextRecurrence(spec, self);
inv = scheduleNextRecurrence(spec, self, start, end);
if (inv !== null) {

@@ -268,5 +290,6 @@ success = self.trackInvocation(inv);

/* Invocation object */
function Invocation(job, fireDate, recurrenceRule) {
function Invocation(job, fireDate, recurrenceRule, endDate) {
this.job = job;
this.fireDate = fireDate;
this.endDate = endDate;
this.recurrenceRule = recurrenceRule || DoesntRecur;

@@ -453,3 +476,3 @@

if (cinv.recurrenceRule.recurs || cinv.recurrenceRule._endDate === null) {
var inv = scheduleNextRecurrence(cinv.recurrenceRule, cinv.job, cinv.fireDate);
var inv = scheduleNextRecurrence(cinv.recurrenceRule, cinv.job, cinv.fireDate, cinv.endDate);
if (inv !== null) {

@@ -492,3 +515,4 @@ inv.job.trackInvocation(inv);

/* Recurrence scheduler */
function scheduleNextRecurrence(rule, job, prevDate) {
function scheduleNextRecurrence(rule, job, prevDate, endDate) {
prevDate = (prevDate instanceof Date) ? prevDate : (new Date());

@@ -501,3 +525,7 @@

var inv = new Invocation(job, date, rule);
if ((endDate instanceof Date) && date.getTime() > endDate.getTime()) {
return null;
}
var inv = new Invocation(job, date, rule, endDate);
scheduleInvocation(inv);

@@ -504,0 +532,0 @@

3

package.json
{
"name": "node-schedule",
"version": "1.1.1",
"version": "1.2.0",
"description": "A cron-like and not-cron-like job scheduler for Node.",

@@ -11,2 +11,3 @@ "keywords": [

],
"license": "MIT",
"main": "./lib/schedule.js",

@@ -13,0 +14,0 @@ "scripts": {

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