Skip to content

Commit

Permalink
Minor refactoring done and updated API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrahul committed May 25, 2020
1 parent 304e55f commit adfb185
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ cron('1 */30 3,6,9 1-7 */1 1', () => {
| `biweekly(job)` | **job: func** `required` - function to be executed |
| `monthly(job, dayOfMonth)` | **job: func** `required` - function to be executed, **dayOfMonth: string** or **number** **{optional}** - 1-31, `default:` **1** |
| `yearly(job)` | **job: func** **required** - function to be executed |
| `stop()` | - Stop all the scheduled job |
| `start()` | - If schedulers have been stopped before then starts again |


## Change Log:
Expand Down
5 changes: 2 additions & 3 deletions cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ export const validate = (schedule: string, date: Date = new Date()) => {
);
}

const didMatch = Object.values(timeObj).every(
(assertion: boolean) => assertion === true,
);
const didMatch = Object.values(timeObj).every(Boolean);
return {
didMatch,
entries: timeObj,
Expand All @@ -118,6 +116,7 @@ const runScheduler = () => {
schedulerTimeIntervalID = setInterval(() => {
if (shouldStopRunningScheduler) {
clearInterval(schedulerTimeIntervalID);
return;
}
executeJobs();
}, 1000);
Expand Down

0 comments on commit adfb185

Please sign in to comment.