npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

constraint-schedulr

v0.0.5

Published

Constraint based cron-like scheduler.

Downloads

20

Readme

schedulr

Constraint based cron-like scheduler.

Summary

Goal for MVP

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(() => {});

Documentation

Installation

npm install constraint-schedulr

What is not ready yet?

  • if function

  • month and year interval

Using chaining for configuration

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.

Authors