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

cronpp

v0.1.2

Published

a way to calculate times based on rules

Readme

#about cronpp is a flexible rule-based framework for determining and scheduling events #philosophy cronpp contains so called conditions which are initialized with a list of possible values. For example dow('sat') is a condition matching all saturdays, month(['apr', 'jun']) matches all Date objects either in April or June. Conditions are functions themselves, and when initialized with a start time return the next matching date after start. The call

month(['apr', 'jun'])(new Date(2016, 0, 18))

returns

Fri Apr 01 2016 00:00:00 GMT+0200 (CEST).

There are multiple condition functions to choose from:

  • month - matches months. Arguments: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] or [0..11] (beware, JS uses zero-indexing on months).
  • month_week - n-th week in month. Arguments: [1..5].
  • day - calendar day in month. Arguments: [1..31].
  • dow - day of the week. Arguments: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] or [0..6].
  • hour - time of day in 24-hour format. Arguments: [0..23].
  • min - minute within the hour. Arguments: [0..59].
  • sec - second. Arguments: [0..59].

Each of these take either a list containining a subset of the values listed in the arguments section or a value from the arguments section as an argument. Therefore dow('sun') and dow(['sun', 'mon']) are both syntactically correct.

All conditions accept a second parameter strict, which determines, wether the input time is a suitable result.

 month(['apr', 'jun'])(new Date(2016, 3, 18))
 //note 'apr' == 3

returns

Fri Apr 01 2016 00:00:00 GMT+0200 (CEST),

whereas

month(['apr', 'jun'])(new Date(2016, 3, 18), true)
//note second argument

returns

Fri Jun 01 2016 00:00:00 GMT+0200 (CEST).

Additionally, there are two meta conditions, which can be used to match other conditions:

  • allof(condition1, condition2, ...) results in a time which matches all conditions passed as arguments.
  • minof(condition1, condition2, ...) gives earliest time satisfying any one of the passed conditions.

Finally, cronpp contains two utility functions which can be used to schedule events

  • at(time, cb) calls cb at time time.
  • after(time, cb) thin wrapper around setTimeout for interface constistency