{"_id":"@fregante/mi-cron","_rev":"1-3f733f0b0a112b9be0ea01cdcb838e8a","name":"@fregante/mi-cron","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@fregante/mi-cron","version":"2.0.0","keywords":["cron","crontab","crontable","date","day","hour","hours","lightweight","micro","minutes","month","parser","schedule","scheduling","small","tiny","week","weekday"],"author":{"url":"https://github.com/cheap-glitch","name":"cheap glitch","email":"cheap.glitch@gmail.com"},"license":"ISC","_id":"@fregante/mi-cron@2.0.0","maintainers":[{"name":"fregante","email":"opensource@bfred.it"}],"homepage":"https://github.com/cheap-glitch/mi-cron#readme","bugs":{"url":"https://github.com/cheap-glitch/mi-cron/issues"},"dist":{"shasum":"57f55e34dabd5c33671e8656060527b311252229","tarball":"https://registry.npmjs.org/@fregante/mi-cron/-/mi-cron-2.0.0.tgz","fileCount":5,"integrity":"sha512-ZLD5kscollZiHK17kqx6CdWdf2bWqNnLfnBjp78HcYGj4dtb2fhYeF8+q8t0kEEcIoNYRhHrQ4yOn7z4k+0EIQ==","signatures":[{"sig":"MEQCIGf6/th+11LO7+gMLSsQ2a9rMkqni4Jsmscw03Yp40TzAiB/uxk/FVUtPTNtWv+Z5JMk3dMlcgsD+OEwpcGrsH2UHw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10540},"jest":{"preset":"ts-jest","coverageDirectory":".coverage"},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":"./dist/index.js","gitHead":"4bc70e9fb3aeec1209d7b174a6857326118c9b7f","scripts":{"lint":"eslint . --ext .ts --ignore-path .gitignore","test":"jest --runInBand","build":"tsc","coverage":"npm test -- --collectCoverage","test:watch":"npm test -- --watch","build:clean":"empty-dir dist && npm run build","build:watch":"tsc --watch","coverage:upload":"coveralls < .coverage/lcov.info"},"_npmUser":{"name":"fregante","email":"opensource@bfred.it"},"repository":{"url":"git+https://github.com/cheap-glitch/mi-cron.git","type":"git"},"_npmVersion":"10.8.1","description":"A microscopic parser for standard cron expressions.","directories":{"test":"test"},"_nodeVersion":"22.3.0","eslintConfig":{"env":{"es6":true},"root":true,"extends":"@cheap-glitch/typescript"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.4.7","eslint":"^8.6.0","terser":"^5.10.0","ts-jest":"^27.1.2","ts-node":"^10.4.0","typescript":"^5.5.4","@types/jest":"^27.4.0","empty-dir-cli":"^1.0.2","@cheap-glitch/tsconfig":"^1.0.0","@typescript-eslint/parser":"^5.9.1","eslint-plugin-smarter-tabs":"^1.2.0","@typescript-eslint/eslint-plugin":"^5.9.1","@cheap-glitch/eslint-config-typescript":"^2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/mi-cron_2.0.0_1723966890141_0.1771937652420572","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"@fregante/mi-cron","version":"2.0.1","description":"A microscopic parser for standard cron expressions.","license":"ISC","author":{"name":"cheap glitch","email":"cheap.glitch@gmail.com","url":"https://github.com/cheap-glitch"},"repository":{"type":"git","url":"git+https://github.com/cheap-glitch/mi-cron.git"},"homepage":"https://github.com/cheap-glitch/mi-cron#readme","bugs":{"url":"https://github.com/cheap-glitch/mi-cron/issues"},"type":"module","keywords":["cron","crontab","crontable","date","day","hour","hours","lightweight","micro","minutes","month","parser","schedule","scheduling","small","tiny","week","weekday"],"main":"dist/index.js","exports":"./dist/index.js","types":"dist/index.d.ts","directories":{"test":"test"},"scripts":{"build":"tsc","build:clean":"empty-dir dist && npm run build","build:watch":"tsc --watch","coverage":"npm test -- --collectCoverage","coverage:upload":"coveralls < .coverage/lcov.info","lint":"eslint . --ext .ts --ignore-path .gitignore","test":"jest --runInBand","test:watch":"npm test -- --watch"},"eslintConfig":{"root":true,"extends":"@cheap-glitch/typescript","env":{"es6":true}},"jest":{"preset":"ts-jest","coverageDirectory":".coverage"},"devDependencies":{"@cheap-glitch/eslint-config-typescript":"^2.2.0","@cheap-glitch/tsconfig":"^1.0.0","@types/jest":"^27.4.0","@typescript-eslint/eslint-plugin":"^5.9.1","@typescript-eslint/parser":"^5.9.1","empty-dir-cli":"^1.0.2","eslint":"^8.6.0","eslint-plugin-smarter-tabs":"^1.2.0","jest":"^27.4.7","terser":"^5.10.0","ts-jest":"^27.1.2","ts-node":"^10.4.0","typescript":"^5.5.4"},"_id":"@fregante/mi-cron@2.0.1","gitHead":"c2c7299208dbeb78a0d62d3ee3f48f993eea1e95","_nodeVersion":"23.1.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-PD1buoAYNp060dJU7/w4Gdif8e+LpPazZOeASO+Y2WQYe/2pYr37ftpU6KETdrBtUsg05iBFglh4j2bjJ3RhpA==","shasum":"1d6440a3ca31856757129b788207a8d435ae596b","tarball":"https://registry.npmjs.org/@fregante/mi-cron/-/mi-cron-2.0.1.tgz","fileCount":5,"unpackedSize":10540,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCm9K4V2dAJks97KBWoMh1I9+bFXiGGvKpQkIkmnQNs/gIhAIey6wQknTtB1l238JmXo7njfA7QYtOFOug7FJCOXWGt"}]},"_npmUser":{"name":"fregante","email":"opensource@bfred.it"},"maintainers":[{"name":"fregante","email":"opensource@bfred.it"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mi-cron_2.0.1_1737724852705_0.8843418678115418"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-18T07:41:30.052Z","modified":"2025-01-24T13:20:53.075Z","2.0.0":"2024-08-18T07:41:30.330Z","2.0.1":"2025-01-24T13:20:52.905Z"},"bugs":{"url":"https://github.com/cheap-glitch/mi-cron/issues"},"author":{"name":"cheap glitch","email":"cheap.glitch@gmail.com","url":"https://github.com/cheap-glitch"},"license":"ISC","homepage":"https://github.com/cheap-glitch/mi-cron#readme","keywords":["cron","crontab","crontable","date","day","hour","hours","lightweight","micro","minutes","month","parser","schedule","scheduling","small","tiny","week","weekday"],"repository":{"type":"git","url":"git+https://github.com/cheap-glitch/mi-cron.git"},"description":"A microscopic parser for standard cron expressions.","maintainers":[{"name":"fregante","email":"opensource@bfred.it"}],"readme":"# 📆 mi-cron\n\n[![License](https://shields.io/github/license/cheap-glitch/mi-cron)](LICENSE)\n[![Latest release](https://shields.io/github/v/release/cheap-glitch/mi-cron?sort=semver&label=latest%20release&color=green)](https://github.com/cheap-glitch/mi-cron/releases/latest)\n[![Coverage status](https://shields.io/coveralls/github/cheap-glitch/mi-cron)](https://coveralls.io/github/cheap-glitch/mi-cron)\n\n**mi-cron** is a microscopic ([~1KB minified & gzipped](https://bundlephobia.com/result?p=@fregante/mi-cron))\nparser for [standard cron expressions](https://en.wikipedia.org/wiki/Cron#CRON_expression).\n\n## Features\n\n * Supports the complete standard cron syntax\n * Supports some convenient syntax extensions: @-shorthands (`@daily`) and steps (`*/10`)\n * Can compute the next scheduled date for a given expression\n * Tiny & dependency-free\n\n## Installation\n\n```\nnpm i @fregante/mi-cron\n```\n\n## Usage\n\n```javascript\nconst { parseCron } = require('@fregante/mi-cron');\n\nconsole.log(parseCron.nextDate('*/5 6-12 3 3 *').toUTCString());\n// Wed, 03 Mar 2021 06:00:00\n```\n\n## API\n\n### parseCron(exp: string): CronSchedule\n\nParses a standard cron expression. Supports:\n * globs (`*`)\n * ranges (`0-30`, `mon-fri`)\n * steps (`*/3`, `20-31/2`, `10/5`)\n * lists (`1,15`, `0-10,20-30/2`)\n * @-shorthands (`@weekly`)\n\nDoes NOT support:\n * `L`, `W`, `#`, `?`, `H`\n * year field\n * `@reboot`\n\nReturns an object with all possible values for each field (minutes, hours, days,\nmonths and days of the week), or `undefined` if the expression is invalid (wrong\nsyntax, unsupported instruction, impossible range, etc).\n\n```javascript\nconst { parseCron } = require('@fregante/mi-cron');\n\nconsole.log(parseCron('*/5 6-10 1,15 * wed'));\n// {\n// \tminutes:  [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55],\n// \thours:    [6, 7, 8, 9, 10],\n// \tdays:     [1, 15],\n// \tmonths:   [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],\n// \tweekDays: [3],\n// }\n```\n\n### parseCron.nextDate(exp: string | CronSchedule[, from: Date = new Date.now()]): Date\n\nTakes a cron schedule  or expression and returns the next  date that matches the\nschedule, or  `undefined` if the expression  is invalid. If given  a datetime as\nthe second argument, it will start  the computation from this time (otherwise it\nwill use the current datetime at the moment it's called).\n\n```javascript\nconst { parseCron } = require('@fregante/mi-cron');\n\nconsole.log(parseCron.nextDate('* * * * *', new Date('01 Jan 2020 00:00:00 GMT')).toUTCString());\n// Wed, 01 Jan 2020 00:01:00\n\n// Get the next five scheduled dates\nconst schedule = parseCron('@weekly');\nconst nextDate = new Date();\nfor (let i=0; i<5; i++) {\n\tconsole.log(nextDate = parseCron.nextDate(schedule, nextDate));\n}\n```\n\n## Changelog\n\nSee the full changelog [here](https://github.com/cheap-glitch/devlint/releases).\n\n## Contributing\n\nContributions are welcomed! Please open an issue before submitting substantial changes.\n\n## Related\n\n * [crontab.guru](https://crontab.guru) – Interactive cron schedule editor\n * [Description of the crontab format](https://crontab.guru/crontab.5.html)\n * [Best practices for cron](https://www.endpoint.com/blog/2008/12/08/best-practices-for-cron)\n\n## License\n\nISC\n","readmeFilename":"README.md"}