@robinpath/cron
v0.1.1
Published
Cron expression parsing, validation, scheduling, and human-readable descriptions
Readme
@robinpath/cron
Cron expression parsing, validation, scheduling, and human-readable descriptions
Why use this module?
The cron module lets you:
- Validate a cron expression
- Parse cron expression into expanded fields
- Get next occurrence after a date
- Get next N occurrences
- Get previous occurrence before a date
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/cronQuick Start
No credentials needed — start using it right away:
cron.parse "0 9 * * 1-5"Available Functions
| Function | Description |
|----------|-------------|
| cron.isValid | Validate a cron expression |
| cron.parse | Parse cron expression into expanded fields |
| cron.next | Get next occurrence after a date |
| cron.nextN | Get next N occurrences |
| cron.prev | Get previous occurrence before a date |
| cron.matches | Check if a date matches a cron expression |
| cron.describe | Human-readable description of a cron expression |
| cron.between | Get all occurrences between two dates |
Examples
Parse cron expression into expanded fields
cron.parse "0 9 * * 1-5"Get next occurrence after a date
cron.next "*/5 * * * *"Get next N occurrences
cron.nextN "0 * * * *" 10Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/cron";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
cron.parse "0 9 * * 1-5"
`);Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
