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

schedulum

v1.0.6

Published

Rule-based employee scheduling engine for Node.js supporting time, day, and person-based constraints.

Downloads

584

Readme

Schedulum Rule Engine

A rule-based employee scheduling engine for Node.js. Supports Time-based, Day-based, and Person-based scheduling constraints with priority ordering.

Designed for deterministic rule execution and clean extensibility.

Features

Time-based rules

must have

at least

at most

Day-based rules

must have

at least

at most

Person-based rules

must have

at least

at most

start with

end with

work with

Frequency support

Specific day ("MONDAY", "TUESDAY", etc.)

"every day"

Availability-aware scheduling

Shift merging support

Deterministic rule execution order

Installation npm install schedulum

Usage const { generateScheduleByRules } = require("schedulum");

const schedule = { employees: [ { employeeId: 1, schedules: [] }, { employeeId: 2, schedules: [] } ] };

const availabilities = { data: [ { employeeId: 1, dayOfWeek: "MONDAY", startTime: "07:00", endTime: "17:00" }, { employeeId: 2, dayOfWeek: "MONDAY", startTime: "07:00", endTime: "17:00" } ] };

const rules = [ { rulesType: "Person-based", condition: "work with", ruleSlot: { type: "employeeId", value: 1 }, conditionSlot: { type: "employeeId", value: 2 }, frequency: "MONDAY" } ];

const result = generateScheduleByRules(schedule, availabilities, rules);

console.log(result);

Rule Structure

Each rule follows this schema:

{ rulesType: "Time-based" | "Day-based" | "Person-based", condition: string, ruleSlot: object, conditionSlot: object, frequency: "every day" | "MONDAY" | ... }

Time-based Rule Example

Ensure at least 3 employees between 07:00–08:00 on Monday:

{ rulesType: "Time-based", condition: "at least", ruleSlot: { startTime: "07:00", endTime: "08:00" }, conditionSlot: { type: "quantity", value: 3 }, frequency: "MONDAY" }

Person-based Rule Examples Start With

Employee 1 starts at the same time as Employee 2:

{ rulesType: "Person-based", condition: "start with", ruleSlot: { type: "employeeId", value: 1 }, conditionSlot: { type: "employeeId", value: 2 }, frequency: "every day" }

End With

Employee 1 ends at the same time as Employee 2.

Work With

Employee 1’s shift exactly matches Employee 2’s shift.

Rule Execution Order

Rules are applied in the following sequence:

Time-based rules

Day-based rules

Person-based rules

This ensures structural constraints are applied before dependency-based alignment rules.

Engine Assumptions

Employees must be available for assigned shifts.

Maximum daily shift length is enforced (default 8 hours if implemented).

Shifts are merged when overlapping.

Rules are processed in defined priority order (Rule #1 highest).

Project Structure (Suggested) /src ├── timeBasedRules.js ├── dayBasedRules.js ├── personBasedRules.js ├── utils.js └── index.js

Extending the Engine

To add a new rule:

Implement it inside the appropriate rules file.

Register it in the rule dispatcher.

Define a new condition string.

The dispatcher uses rulesType and condition to route execution.

License

MIT