diff --git a/.babelrc b/.babelrc index 9370948..818eab0 100644 --- a/.babelrc +++ b/.babelrc @@ -6,10 +6,7 @@ "env", { "targets": { - "browsers": [ - "last 2 versions", - "ie >= 10" - ] + "browsers": [ "last 2 versions", "ie >= 10" ] } } ] diff --git a/README.md b/README.md index cd391a0..a155c31 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # cronmatch -`cronmatch` is a simple cron expression parser. It compares a provided date string or `Date` object with a cron expression to see if it matches. +`Cronmatch` is a simple cron expression parser. It compares a provided date string or `Date` object with a cron expression to see if it matches. ## Installation For use in Node: ``` -npm install cronmatch +npm install @paulsmith/cronmatch ``` For use in the browser: @@ -14,4 +14,31 @@ For use in the browser: ``` -## Usage \ No newline at end of file +## Usage + +``` + +const cronmatch = require('cronmatch'); + +var cronExpr = '*/2 * * * *'; // Every even minute +var date1 = new Date('January 20, 2020 12:00:00'); +var date2 = new Date('January 20, 2020 12:01:00'); + +cronmatch(cronExpr, date1); // true +cronmatch(cronExpr, date2); // false + +``` + +minute: [0, 59] +hour: [0, 23] +day: [1, 31] +month: [1, 12] +dayOfWeek: [0, 6] + + + +## Limitations + +* `cronmatch` does not yet understand 6-field cron expressions with seconds +* It does not yet validate cron expressions +* Does not yet support JAN-DEC for month or MON-SUN for dayOfWeek \ No newline at end of file diff --git a/src/index.js b/src/index.js index 8e18f76..b25fd8f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,5 @@ import getRange from './getRange'; - -// const stepInterval = (expr) => { -// }; - const fieldHit = (field) => { var range, step; var values = [];