
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
constraint-schedulr
Advanced tools
Constraint based cron-like scheduler.
schedulr run(int)
schedulr times()
, schedulr in()
schedulr every()
schedulr years()
, schedulr months()
, schedulr weeks()
, schedulr days()
, schedulr hours()
, schedulr minutes()
, schedulr seconds()
schedulr fromNow()
, schedulr fromStartOfDay()
schedult if(array)
schedulr function(function)
schedulr and(int)
const s = require("schedulr");
// Runs function every 8 hours (start time is now, so, current time - time of beggining % 8h == 0) if day is monday.
s.run().every(8).hours().fromNow().if({day: "monday"}).function(() => {});
// Runs function every 8 hours (start time is today, so, current time - day of the beggining % 8h == 0) if day is monday.
s.run().every(8).hours().fromStartOfDay().if({day: "monday"}).function(() => {});
// Runs on *:00:00 if it is third week of month.
s.run().on().hour().if({week: 3}).function(() => {});
// Runs 8 times each hour if week is 3th.
s.run(8).times().in().hour().if({week: 3}).function(() => {});
npm install constraint-schedulr
if function
month and year interval
Since most of cron-like schedulers are hard to learn for people who are just starting, I decided to make my very easy for humans to read and also made it so users can do a lot more customization that way.
schedulr run(int)
run
takes as param the number of times you want to run function in certain interval. default is 1
schedulr times()
, schedulr in()
These functions are there just to make chain mora human readable.
schedulr every()
Sets multiplier for time interval.
These functions are there just to make chain mora human readable.
schedulr years()
, schedulr months()
, schedulr weeks()
, schedulr days()
, schedulr hours()
, schedulr minutes()
, schedulr seconds()
These functions add constraint so function runs every x * time interval, based on value set using schedulr every(int)
These functions are there just to make chain mora human readable.
schedulr fromNow()
, schedulr fromStartOfDay()
These 2 functions set reference point for constraint solver to calculate intervals against. Default value is now.
schedult if(array)
This function takes array of constraints and adds them to constraints array.
schedulr function(function)
This function adds function to list of functions to be called when constraints added so far got resolved.
schedulr and(int)
This function starts new constraint and uses the same arguments as run
.
FAQs
Constraint based cron-like scheduler.
We found that constraint-schedulr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.