@finbheara/domain 0.35.0 → 0.36.0

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.
package/dist/age.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ printsUnderOpen2,
2
3
  TITLE_RANGE_MIN2,
3
4
  TITLE_RANGE_MAX2,
4
5
  ageTitleToken2,
@@ -12,6 +13,7 @@ import {
12
13
  MIN_MAJOR_AGE2,
13
14
  MIN_FEIS_AGE2,
14
15
  YOUNGEST_BAND_TOP2,
16
+ OLDEST_BAND_FLOOR2,
15
17
  YOB_RANGE2,
16
18
  DANCE_UP_YEARS2,
17
19
  ageOnJanuary12,
@@ -35,7 +37,7 @@ import {
35
37
  youngFloor2,
36
38
  tooYoungForMajor2,
37
39
  tooYoungForFeis2
38
- } from "./chunks/place-8k74cr5j.js";
40
+ } from "./chunks/place-3w1mr2vh.js";
39
41
  export {
40
42
  ADULT_FLOOR2 as ADULT_FLOOR,
41
43
  AVERAGE_AGE_DECIMALS2 as AVERAGE_AGE_DECIMALS,
@@ -45,6 +47,7 @@ export {
45
47
  MAJORS_FLOOR_YEARS2 as MAJORS_FLOOR_YEARS,
46
48
  MIN_FEIS_AGE2 as MIN_FEIS_AGE,
47
49
  MIN_MAJOR_AGE2 as MIN_MAJOR_AGE,
50
+ OLDEST_BAND_FLOOR2 as OLDEST_BAND_FLOOR,
48
51
  TITLE_RANGE_MAX2 as TITLE_RANGE_MAX,
49
52
  TITLE_RANGE_MIN2 as TITLE_RANGE_MIN,
50
53
  UNDER_CAP2 as UNDER_CAP,
@@ -64,6 +67,7 @@ export {
64
67
  canOverlap2 as canOverlap,
65
68
  intersectBirthYears2 as intersectBirthYears,
66
69
  isAveraged2 as isAveraged,
70
+ printsUnderOpen2 as printsUnderOpen,
67
71
  roundedMeanHundredths2 as roundedMeanHundredths,
68
72
  tooYoungForFeis2 as tooYoungForFeis,
69
73
  tooYoungForMajor2 as tooYoungForMajor,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Age2,
3
3
  ageRelation2
4
- } from "./place-8k74cr5j.js";
4
+ } from "./place-3w1mr2vh.js";
5
5
  import {
6
6
  validity
7
7
  } from "./place-q9kwsmzd.js";
@@ -13,6 +13,8 @@ var UNDER = new RegExp(String.raw`${UNDER_WORD}(\d{1,2})(?![0-9])(?![a-z][a-z0-9
13
13
  var JOINED_CAPS = new RegExp(String.raw`${UNDER_WORD}\d{1,2}(?![0-9])(?:(?:\s*(?:&|,|\/|\band\b)\s*(?:${UNDER_WORD})?|\s+${UNDER_WORD})\d{1,2}(?![0-9]))+`, "i");
14
14
  var JOINED_NOT = /^(?:\s*(?:yrs?|years?|-?\s*hand)\b|[a-z])/i;
15
15
  var JOINED_OPEN = /^(?:\s*\+|\s*(?:&|and)\s*(?:o|over|older|up)\b)/i;
16
+ var UNDER_OPEN = new RegExp(String.raw`${UNDER_WORD}\d{1,2}(?![0-9])\s*(?:&|\band\b)\s*(?:o|over|older|up)\b`, "i");
17
+ var printsUnderOpen2 = (print) => UNDER_OPEN.test(print);
16
18
  var UNDER_STRIDE = /^\s*\/\s*0*([1-9]\d?)\s*yrs?(?![a-z0-9])/i;
17
19
  var AND_UNDER = /(?<![a-z0-9])(\d{1,2})\s*(?:years?\s*)?(?:&|\/|\band\b)\s*u(?:nder)?(?![a-z])(?!\s*\d)/i;
18
20
  var AND_UNDER_RANGE = /(?<![a-z0-9])(\d{1,2})\s*(?:&|\band\b)\s*under\s*(\d{1,2})(?![a-z0-9])/i;
@@ -60,6 +62,8 @@ function readAnchored(title, s, offset, aside = false) {
60
62
  const joined = readJoined(title, s, offset);
61
63
  if (joined !== null)
62
64
  return joined;
65
+ if (UNDER_OPEN.test(s))
66
+ return NONE;
63
67
  for (const re of [AND_OVER, OVER_WORD, OVER_GLUED]) {
64
68
  const m = re.exec(s);
65
69
  if (m?.[1] !== undefined)
@@ -188,6 +192,7 @@ var YOUNG_FLOOR2 = Object.freeze({ hard: 2, soft: 4 });
188
192
  var MIN_MAJOR_AGE2 = 4;
189
193
  var MIN_FEIS_AGE2 = 3;
190
194
  var YOUNGEST_BAND_TOP2 = MAJORS_FLOOR_YEARS2;
195
+ var OLDEST_BAND_FLOOR2 = 100;
191
196
  var YOB_RANGE2 = Object.freeze({ first: 1901, last: 2099 });
192
197
  var DANCE_UP_YEARS2 = 1;
193
198
  var ageOnJanuary12 = (year, born) => year - born - 1;
@@ -347,6 +352,11 @@ function refuseBelowYoungest(r) {
347
352
  return r;
348
353
  return { ...r, interval: null, refusal: "below-youngest-band", clauses: [] };
349
354
  }
355
+ function refuseAboveOldest(r) {
356
+ if (r.interval === null || r.interval.lo < OLDEST_BAND_FLOOR2)
357
+ return r;
358
+ return { ...r, interval: null, refusal: "above-oldest-band", clauses: [] };
359
+ }
350
360
 
351
361
  class AgeMisuseError2 extends Error {
352
362
  misuse;
@@ -377,7 +387,7 @@ function fromPrint(print, context = {}) {
377
387
  const ladder = context.ladder ?? NO_LADDER;
378
388
  const year = context.year === undefined ? currentYear() : context.year;
379
389
  const ag1 = print.trim().toLowerCase();
380
- const reading = ag1 === "" ? { kind: null, interval: null, refusal: null, clauses: [], parts: [] } : refuseBelowYoungest(read(print.trim(), ladder, context.top === true));
390
+ const reading = ag1 === "" ? { kind: null, interval: null, refusal: null, clauses: [], parts: [] } : refuseAboveOldest(refuseBelowYoungest(read(print.trim(), ladder, context.top === true)));
381
391
  const iv = reading.interval;
382
392
  const arm = ag1 === "" ? "empty" : iv === null ? "open" : "band";
383
393
  const ag2 = iv !== null ? display(iv) : ag1 === "" ? "" : `${ag1}?`;
@@ -652,4 +662,4 @@ function youngFloor2(year, oldest) {
652
662
  var tooYoungForMajor2 = (year, oldest) => yearsSinceBirth2(year, oldest) < MIN_MAJOR_AGE2;
653
663
  var tooYoungForFeis2 = (year, oldest) => yearsSinceBirth2(year, oldest) < MIN_FEIS_AGE2;
654
664
 
655
- export { TITLE_RANGE_MIN2, TITLE_RANGE_MAX2, ageTitleToken2, adultBeside2, YOUNGEST_FLOOR2, ADULT_FLOOR2, MAJORS_FLOOR_YEARS2, UNDER_CAP2, UNDER_CAP_MAX_TOP2, YOUNG_FLOOR2, MIN_MAJOR_AGE2, MIN_FEIS_AGE2, YOUNGEST_BAND_TOP2, YOB_RANGE2, DANCE_UP_YEARS2, ageOnJanuary12, yearsSinceBirth2, AgeMisuseError2, Age2, birthYearsOfInterval2, ageRelation2, canOverlap2, AVERAGE_AGE_DECIMALS2, roundedMeanHundredths2, isAveraged2, averageAge2, birthYearsDisjoint2, intersectBirthYears2, birthYearsMeet2, underCapApplies2, underCappedYears2, underCapRefuses2, validYOB2, youngFloor2, tooYoungForMajor2, tooYoungForFeis2 };
665
+ export { printsUnderOpen2, TITLE_RANGE_MIN2, TITLE_RANGE_MAX2, ageTitleToken2, adultBeside2, YOUNGEST_FLOOR2, ADULT_FLOOR2, MAJORS_FLOOR_YEARS2, UNDER_CAP2, UNDER_CAP_MAX_TOP2, YOUNG_FLOOR2, MIN_MAJOR_AGE2, MIN_FEIS_AGE2, YOUNGEST_BAND_TOP2, OLDEST_BAND_FLOOR2, YOB_RANGE2, DANCE_UP_YEARS2, ageOnJanuary12, yearsSinceBirth2, AgeMisuseError2, Age2, birthYearsOfInterval2, ageRelation2, canOverlap2, AVERAGE_AGE_DECIMALS2, roundedMeanHundredths2, isAveraged2, averageAge2, birthYearsDisjoint2, intersectBirthYears2, birthYearsMeet2, underCapApplies2, underCappedYears2, underCapRefuses2, validYOB2, youngFloor2, tooYoungForMajor2, tooYoungForFeis2 };
package/dist/schedule.js CHANGED
@@ -1,8 +1,8 @@
1
- import"./chunks/place-8k74cr5j.js";
1
+ import"./chunks/place-3w1mr2vh.js";
2
2
  import {
3
3
  compTitle2,
4
4
  matchTitle2
5
- } from "./chunks/place-fsxsxdhk.js";
5
+ } from "./chunks/place-36esw9p7.js";
6
6
 
7
7
  function hallKey(hall) {
8
8
  return hall.normalize("NFKD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
package/dist/title.js CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  titleRelation2,
7
7
  ladderOf2,
8
8
  matchTitle2
9
- } from "./chunks/place-fsxsxdhk.js";
10
- import"./chunks/place-8k74cr5j.js";
9
+ } from "./chunks/place-36esw9p7.js";
10
+ import"./chunks/place-3w1mr2vh.js";
11
11
  export {
12
12
  compTitle2 as compTitle,
13
13
  ladderOf2 as ladderOf,
@@ -1,3 +1,4 @@
1
+ export declare const printsUnderOpen: (print: string) => boolean;
1
2
  export declare const TITLE_RANGE_MIN = 3;
2
3
  export declare const TITLE_RANGE_MAX = 40;
3
4
  export interface AgeTitleSpan {
@@ -23,7 +23,7 @@ export interface AgeContext {
23
23
  }
24
24
  export type AgeArm = "band" | "yob" | "open" | "empty";
25
25
  export type AgeKind = "under" | "over" | "range" | "adult" | "senior" | "yob";
26
- export type AgeRefusal = "not-a-band" | "backwards-range" | "overlapping-ranges" | "senior-without-ladder" | "below-youngest-band" | "year-out-of-range";
26
+ export type AgeRefusal = "not-a-band" | "backwards-range" | "overlapping-ranges" | "senior-without-ladder" | "below-youngest-band" | "above-oldest-band" | "year-out-of-range";
27
27
  export type AgeSource = "sibling-narrowed" | "printed-band" | "printed-range" | "printed-yob" | "open";
28
28
  export type AgeClause = "under-floored-on-rung" | "under-stride" | "youngest-absorbs" | "over-ceiling-from-next-over" | "over-ceiling-refused-gap" | "and-over-no-ceiling" | "adult-under-ceiling" | "adult-band" | "range-overlapping" | "range-as-under" | "range-top-meets-over" | "range-adult-floor";
29
29
  export type AgeRelation = "same" | "contains" | "overlaps" | "disjoint" | "silent";
@@ -1,7 +1,7 @@
1
1
  import { type AgeTitleSpan } from "./age-title.ts";
2
2
  import type { AgeArm, AgeClause, AgeComparison, AgeContext, AgeInterval, AgeKind, AgeLadder, AgeMisuse, AgeRefusal, AgeRelation, AgeRelationReason, AgeSource, AgeSpan, BirthYears, YOBContext, YoungFloorVerdict } from "./age-types.ts";
3
3
  import { type EmptyReason, type Validated } from "./validated.ts";
4
- export { type AgeTitleSpan, type AgeTitleToken, TITLE_RANGE_MAX, TITLE_RANGE_MIN, adultBeside, ageTitleToken, } from "./age-title.ts";
4
+ export { type AgeTitleSpan, type AgeTitleToken, TITLE_RANGE_MAX, TITLE_RANGE_MIN, adultBeside, ageTitleToken, printsUnderOpen, } from "./age-title.ts";
5
5
  export type { AgeArm, AgeClause, AgeComparison, AgeContext, AgeInterval, AgeKind, AgeLadder, AgeMisuse, AgeRefusal, AgeRelation, AgeRelationReason, AgeSource, AgeSpan, BirthYears, EmptyReason, Validated, YOBContext, YoungFloorVerdict, };
6
6
  export declare const YOUNGEST_FLOOR = 0;
7
7
  export declare const ADULT_FLOOR = 18;
@@ -18,6 +18,7 @@ export declare const YOUNG_FLOOR: Readonly<{
18
18
  export declare const MIN_MAJOR_AGE = 4;
19
19
  export declare const MIN_FEIS_AGE = 3;
20
20
  export declare const YOUNGEST_BAND_TOP = 3;
21
+ export declare const OLDEST_BAND_FLOOR = 100;
21
22
  export declare const YOB_RANGE: Readonly<{
22
23
  readonly first: 1901;
23
24
  readonly last: 2099;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/domain",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Places, CLRG regions, school names, ages, dances, competition titles and schedules, and a person's print in its role, as they are printed: read, compared and told apart",
5
5
  "keywords": [
6
6
  "places",
@@ -89,7 +89,7 @@
89
89
  "prepublishOnly": "bun scripts/build.ts && bun scripts/guard-tarball.ts"
90
90
  },
91
91
  "dependencies": {
92
- "@finbheara/names": "0.20.0"
92
+ "@finbheara/names": "0.21.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "typescript": "7.0.2"