Skip to content

Commit

Permalink
Fix bug with 'foo' counting as a day and expose version
Browse files Browse the repository at this point in the history
  • Loading branch information
rautio committed Oct 18, 2023
1 parent cc3412e commit f4ea4d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crontext",
"version": "0.2.7",
"version": "0.2.8",
"description": "Simple utility for parsing human text into a cron schedule.",
"files": [
"lib"
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as next from './next';
import { parseOptions } from './options';
import type { InputOptions } from './options';

const pJson = require('../package.json');

export const parseText = (input: string, options?: InputOptions): string => {
const tokens = tokenize(input);
const parsed = parse(tokens, parseOptions(options));
Expand All @@ -14,6 +16,8 @@ export const parseText = (input: string, options?: InputOptions): string => {

export const nextDate = next.nextDate;

export const version = pJson.version;

/**
* Output:
* - cron: * * * * *
Expand Down
2 changes: 1 addition & 1 deletion src/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const tokens = {
test: '^(hours|hour|hrs|hr)$',
},
[TokenType.DAYS]: {
test: 'month|^(days|day|foo|month|months|week|weeks)$',
test: 'month|^(days|day|month|months|week|weeks)$',
},
[TokenType.RELATIVE_DAY]: {
test: '^(tomorrow)$',
Expand Down

0 comments on commit f4ea4d9

Please sign in to comment.