chrono-node 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,6 @@ import { ParsingContext } from "../../../chrono";
2
2
  import { ParsingComponents } from "../../../results";
3
3
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary";
4
4
  export default class RUTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
5
- private readonly patternWithPrefix;
6
- private readonly patternWithoutPrefix;
7
- constructor();
8
5
  patternLeftBoundary(): string;
9
6
  innerPattern(context: ParsingContext): RegExp;
10
7
  innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents;
@@ -5,16 +5,13 @@ const results_1 = require("../../../results");
5
5
  const AbstractParserWithWordBoundary_1 = require("../../../common/parsers/AbstractParserWithWordBoundary");
6
6
  const PATTERN = `(?:(?:около|примерно)\\s*(?:~\\s*)?)?(${constants_1.TIME_UNITS_PATTERN})${constants_1.REGEX_PARTS.rightBoundary}`;
7
7
  class RUTimeUnitWithinFormatParser extends AbstractParserWithWordBoundary_1.AbstractParserWithWordBoundaryChecking {
8
- constructor() {
9
- super();
10
- this.patternWithPrefix = new RegExp(`(?:в течение|в течении)\\s*${PATTERN}`, constants_1.REGEX_PARTS.flags);
11
- this.patternWithoutPrefix = new RegExp(PATTERN, constants_1.REGEX_PARTS.flags);
12
- }
13
8
  patternLeftBoundary() {
14
9
  return constants_1.REGEX_PARTS.leftBoundary;
15
10
  }
16
11
  innerPattern(context) {
17
- return context.option.forwardDate ? this.patternWithoutPrefix : this.patternWithPrefix;
12
+ return context.option.forwardDate
13
+ ? new RegExp(PATTERN, constants_1.REGEX_PARTS.flags)
14
+ : new RegExp(`(?:в течение|в течении)\\s*${PATTERN}`, constants_1.REGEX_PARTS.flags);
18
15
  }
19
16
  innerExtract(context, match) {
20
17
  const timeUnits = constants_1.parseTimeUnits(match[1]);
@@ -1 +1 @@
1
- {"version":3,"file":"RUTimeUnitWithinFormatParser.js","sourceRoot":"","sources":["../../../../../src/locales/ru/parsers/RUTimeUnitWithinFormatParser.ts"],"names":[],"mappings":";;AAAA,4CAA+E;AAE/E,8CAAqD;AACrD,2GAAgH;AAEhH,MAAM,OAAO,GAAG,yCAAyC,8BAAkB,IAAI,uBAAW,CAAC,aAAa,EAAE,CAAC;AAE3G,MAAqB,4BAA6B,SAAQ,uEAAsC;IAI5F;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,iBAAiB,GAAG,IAAI,MAAM,CAAC,8BAA8B,OAAO,EAAE,EAAE,uBAAW,CAAC,KAAK,CAAC,CAAC;QAChG,IAAI,CAAC,oBAAoB,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,uBAAW,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IAED,mBAAmB;QACf,OAAO,uBAAW,CAAC,YAAY,CAAC;IACpC,CAAC;IAED,YAAY,CAAC,OAAuB;QAChC,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;IAC3F,CAAC;IAED,YAAY,CAAC,OAAuB,EAAE,KAAuB;QACzD,MAAM,SAAS,GAAG,0BAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,2BAAiB,CAAC,2BAA2B,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;CACJ;AAtBD,+CAsBC"}
1
+ {"version":3,"file":"RUTimeUnitWithinFormatParser.js","sourceRoot":"","sources":["../../../../../src/locales/ru/parsers/RUTimeUnitWithinFormatParser.ts"],"names":[],"mappings":";;AAAA,4CAA+E;AAE/E,8CAAqD;AACrD,2GAAgH;AAEhH,MAAM,OAAO,GAAG,yCAAyC,8BAAkB,IAAI,uBAAW,CAAC,aAAa,EAAE,CAAC;AAE3G,MAAqB,4BAA6B,SAAQ,uEAAsC;IAC5F,mBAAmB;QACf,OAAO,uBAAW,CAAC,YAAY,CAAC;IACpC,CAAC;IAED,YAAY,CAAC,OAAuB;QAChC,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW;YAC7B,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,uBAAW,CAAC,KAAK,CAAC;YACxC,CAAC,CAAC,IAAI,MAAM,CAAC,8BAA8B,OAAO,EAAE,EAAE,uBAAW,CAAC,KAAK,CAAC,CAAC;IACjF,CAAC;IAED,YAAY,CAAC,OAAuB,EAAE,KAAuB;QACzD,MAAM,SAAS,GAAG,0BAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,2BAAiB,CAAC,2BAA2B,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;CACJ;AAfD,+CAeC"}
@@ -2,9 +2,6 @@ import { ParsingContext } from "../../../chrono.js";
2
2
  import { ParsingComponents } from "../../../results.js";
3
3
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary.js";
4
4
  export default class RUTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
5
- private readonly patternWithPrefix;
6
- private readonly patternWithoutPrefix;
7
- constructor();
8
5
  patternLeftBoundary(): string;
9
6
  innerPattern(context: ParsingContext): RegExp;
10
7
  innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents;
@@ -3,16 +3,13 @@ import { ParsingComponents } from "../../../results.js";
3
3
  import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/AbstractParserWithWordBoundary.js";
4
4
  const PATTERN = `(?:(?:около|примерно)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})${REGEX_PARTS.rightBoundary}`;
5
5
  export default class RUTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
6
- constructor() {
7
- super();
8
- this.patternWithPrefix = new RegExp(`(?:в течение|в течении)\\s*${PATTERN}`, REGEX_PARTS.flags);
9
- this.patternWithoutPrefix = new RegExp(PATTERN, REGEX_PARTS.flags);
10
- }
11
6
  patternLeftBoundary() {
12
7
  return REGEX_PARTS.leftBoundary;
13
8
  }
14
9
  innerPattern(context) {
15
- return context.option.forwardDate ? this.patternWithoutPrefix : this.patternWithPrefix;
10
+ return context.option.forwardDate
11
+ ? new RegExp(PATTERN, REGEX_PARTS.flags)
12
+ : new RegExp(`(?:в течение|в течении)\\s*${PATTERN}`, REGEX_PARTS.flags);
16
13
  }
17
14
  innerExtract(context, match) {
18
15
  const timeUnits = parseTimeUnits(match[1]);
@@ -1 +1 @@
1
- {"version":3,"file":"RUTimeUnitWithinFormatParser.js","sourceRoot":"","sources":["../../../../../src/locales/ru/parsers/RUTimeUnitWithinFormatParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sCAAsC,EAAE,MAAM,wDAAwD,CAAC;AAEhH,MAAM,OAAO,GAAG,yCAAyC,kBAAkB,IAAI,WAAW,CAAC,aAAa,EAAE,CAAC;AAE3G,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,sCAAsC;IAI5F;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,iBAAiB,GAAG,IAAI,MAAM,CAAC,8BAA8B,OAAO,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QAChG,IAAI,CAAC,oBAAoB,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;IAED,mBAAmB;QACf,OAAO,WAAW,CAAC,YAAY,CAAC;IACpC,CAAC;IAED,YAAY,CAAC,OAAuB;QAChC,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC;IAC3F,CAAC;IAED,YAAY,CAAC,OAAuB,EAAE,KAAuB;QACzD,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,iBAAiB,CAAC,2BAA2B,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;CACJ"}
1
+ {"version":3,"file":"RUTimeUnitWithinFormatParser.js","sourceRoot":"","sources":["../../../../../src/locales/ru/parsers/RUTimeUnitWithinFormatParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sCAAsC,EAAE,MAAM,wDAAwD,CAAC;AAEhH,MAAM,OAAO,GAAG,yCAAyC,kBAAkB,IAAI,WAAW,CAAC,aAAa,EAAE,CAAC;AAE3G,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,sCAAsC;IAC5F,mBAAmB;QACf,OAAO,WAAW,CAAC,YAAY,CAAC;IACpC,CAAC;IAED,YAAY,CAAC,OAAuB;QAChC,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW;YAC7B,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC;YACxC,CAAC,CAAC,IAAI,MAAM,CAAC,8BAA8B,OAAO,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACjF,CAAC;IAED,YAAY,CAAC,OAAuB,EAAE,KAAuB;QACzD,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,iBAAiB,CAAC,2BAA2B,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;CACJ"}
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "preset": "ts-jest"
16
16
  },
17
17
  "license": "MIT",
18
- "version": "2.7.1",
18
+ "version": "2.7.2",
19
19
  "directories": {
20
20
  "source": "./src",
21
21
  "test": "./test"
@@ -6,21 +6,14 @@ import { AbstractParserWithWordBoundaryChecking } from "../../../common/parsers/
6
6
  const PATTERN = `(?:(?:около|примерно)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})${REGEX_PARTS.rightBoundary}`;
7
7
 
8
8
  export default class RUTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
9
- private readonly patternWithPrefix: RegExp;
10
- private readonly patternWithoutPrefix: RegExp;
11
-
12
- constructor() {
13
- super();
14
- this.patternWithPrefix = new RegExp(`(?:в течение|в течении)\\s*${PATTERN}`, REGEX_PARTS.flags);
15
- this.patternWithoutPrefix = new RegExp(PATTERN, REGEX_PARTS.flags);
16
- }
17
-
18
9
  patternLeftBoundary(): string {
19
10
  return REGEX_PARTS.leftBoundary;
20
11
  }
21
12
 
22
13
  innerPattern(context: ParsingContext): RegExp {
23
- return context.option.forwardDate ? this.patternWithoutPrefix : this.patternWithPrefix;
14
+ return context.option.forwardDate
15
+ ? new RegExp(PATTERN, REGEX_PARTS.flags)
16
+ : new RegExp(`(?:в течение|в течении)\\s*${PATTERN}`, REGEX_PARTS.flags);
24
17
  }
25
18
 
26
19
  innerExtract(context: ParsingContext, match: RegExpMatchArray): ParsingComponents {