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 🙏

© 2024 – Pkg Stats / Ryan Hefner

crontimex

v0.0.7

Published

None-dependencies Cron Time Expression Generator/Builder written in Typescript

Downloads

17

Readme

CronTimex

Cron Time Expression Generator/Builder written in Typescript. It is a non-class-based port of Cron-Time. Every functionality remains the same as in Cron-Time; it is just not class-based.

Tested on CronTab.Guru

Install

npm install crontimex

OR

yarn add crontimex

Setup

// Javascript
const { CronTimex } = require('crontimex');
// OR
const { default: CronTimex } = require('crontimex');

// Typescript
import { CronTimex } from 'crontimex';
// OR
import CronTimex from 'crontimex';

The CronTimex contains all the methods for generating cron expressions. it is the default export of the package and also has a named export called CronTimex

CronTimex.everyMinute();
// * * * * *

CronTimex.everyHour();
// 0 * * * *

CronTimex.everyDay();
// 0 0 * * *

CronTimex.everyDayAt(6);
// 0 6 * * *

CronTimex.everyDayAt(6, 15);
// 15 6 * * *

CronTimex.everySunday();
// 0 0 * * SUN

CronTimex.everySundayAt(4, 30);
// 30 4 * * SUN

CronTimex.everyWeekDay();
// 0 0 * * 1-5
// from Monday to Friday

CronTimex.everyWeekDayAt(1, 30);
// 30 1 * * 1-5
// 1:30 AM from Monday to Friday

CronTimex.everyWeekend();
// 0 0 * * 6,0
// on Saturday and Sunday

CronTimex.everyWeekendAt(1, 30);
// 30 1 * * 6,0
// 1:30 AM on Saturday and Sunday

// E.T.C

For everyWeekDay and everyWeekend there is also an option to change the starting day.

By default, week days is from Monday to Friday while weekend days are Saturdays and Sundays

This can be changed like so:

CronTimex.everyWeekDay('sunday', 'thursday');
// 0 0 * * 0-4
// from Sunday to Thursday

CronTimex.everyWeekDayAt(1, 30, 'sunday', 'thursday');
// 30 1 * * 0-4
// 1:30 AM from Sunday to Thursday

CronTimex.everyWeekend('friday', 'saturday');
// 0 0 * * 5,6
// on Friday and Saturday

CronTimex.everyWeekendAt(1, 30, 'friday', 'saturday');
// 30 1 * * 5,6
// 1:30 AM on Friday and Saturday

Note: if a startDay is specified then an endDay must be specified also, else it will use the default values which may not tally with your new $startDay

Every method of CronTimex returns exactly what its name says.

onSpecificDays and onSpecificDaysAt

To target specific days

CronTimex.onSpecificDays(['sunday', 'tuesday', 'thursday']); // 0 0 * * 0,2,4

// With time
CronTimex.onSpecificDaysAt(['sunday', 'tuesday', 'thursday'], 3, 30); // 0 0 * * 0,2,4

Every Nth Time

const CronTimex = require('crontimex');

CronTimex.every(5).minutes();
// Every Five Minutes

CronTimex.every(2).hours();
// Every 2 Hours

CronTimex.every(7).days();
// Every 7 Days

CronTimex.every(7).days(9, 5);
// Every 7 days at 9:05

CronTimex.every('even').hours();
// Every Even Hours
// * */2 * * *

CronTimex.every('uneven').hours();
// Every Uneven Hours
// * 1-23/2 * * *

Between

const { CronTimex } = require('crontimex');

CronTimex.between(1, 4).days();
// Between  1 - 4 th day of the month

All Functions

every

between

everyMinute

everyHour

everyHourAt(minuteOfTheHour)

everyDay

everyDayAt(hoursOfTheDay)

everySunday

everySundayAt(hours, minutes?)

everyMonday

everyMondayAt(hours, minutes?)

everyTuesday

everyTuesdayAt(hours, minutes?)

everyWednesday

everyWednesdayAt(hours, minutes?)

everyThursday

everyThursdayAt(hours, minutes?)

everyFriday

everyFridayAt(hours, minutes?)

everySaturday

everySaturdayAt(hours, minutes?)

everyWeek

everyWeekAt(days, hours?, minutes?)

everyWeekDay

everyWeekDayAt(hours, minutes?, startDay?, endDay?)

everyWeekend

everyWeekendAt(hours, minutes?, startDay?, endDay?)

everyMonth

everyMonthOn(days, hours?, minutes?)

everyYear

everyYearIn(months, days?, hours?, minutes?)

onSpecificDays(days)

onSpecificDaysAt(days, hour, minutes?)