edfcore 0.3.50 → 0.3.52

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/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ alone does not tell you whether you were affected.
6
6
  edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
7
7
  defect; those are called out below.
8
8
 
9
+ ## 0.3.52
10
+
11
+ - **Documented** `-v`. `parseArgs` has accepted it as an alias for `--version` for as long as it has
12
+ accepted `--version`, and the usage banner printed `--version` alone — while printing `--help, -h`
13
+ with its alias two lines above. A flag that works and is not in `--help` is one nobody can find
14
+ and nobody can rely on.
15
+ - `tests/integration/cli.test.ts` now derives the flag list from `parseArgs` itself and requires
16
+ every accepted flag to appear in the usage banner, so a new one fails the suite until it is
17
+ documented.
18
+ - The check matches whole tokens, not substrings. `expect(usage).toContain('-v')` is satisfied by
19
+ the `-v` inside `--version` — that is, by the exact text that had the bug — so the obvious
20
+ spelling of this guard would have passed on it. There is an assertion pinning that distinction
21
+ beside the others, because it is the only reason this test works.
22
+
23
+ ## 0.3.51
24
+
25
+ - **Corrected** the `filterAnnotationsByText` docblock, which said a string "matches on the exact
26
+ trimmed text". Nothing is trimmed: `annotation.text` is the TAL's bytes as written — `api-types.md`
27
+ calls the field "verbatim; never trimmed, never case-folded" — and the comparison is a bare `===`.
28
+ - The word mattered because the failure it hides is silent. An event a scorer spelled
29
+ `'Sleep stage W '` is not matched by `'Sleep stage W'`, and the call returns an empty list
30
+ rather than an error, so a hypnogram over a file with a padded vocabulary comes back with no
31
+ stages and no explanation.
32
+ - Both the docblock and `api-helpers.md` now say verbatim on both sides, and both name the
33
+ one-liner for the other question: `filterAnnotationsByText(events, (t) => t.trim() === label)`.
34
+ - No behaviour change — `edfcore` matched verbatim before and matches verbatim now. The exact rule
35
+ is pinned by a test in both directions, so the comment cannot drift away from it again.
36
+
9
37
  ## 0.3.50
10
38
 
11
39
  - **Fixed** the "Renamed in 0.3.0" note in `api-helpers.md`, which was attached to the wrong family
@@ -31,10 +31,18 @@ export declare function filterAnnotationsByTime(annotations: readonly EdfAnnotat
31
31
  /**
32
32
  * The annotations whose text matches.
33
33
  *
34
- * A string matches on the exact trimmed text, because annotation vocabularies are controlled —
34
+ * A string matches the text VERBATIM, because annotation vocabularies are controlled —
35
35
  * `Sleep stage W` is a fixed token, and a substring match on `W` would also catch `Sleep stage
36
36
  * REM` in files that spell it `W/REM`. Pass a predicate or a RegExp when you want something
37
37
  * looser; edfcore does not guess which you meant.
38
+ *
39
+ * Verbatim means verbatim, in both directions: `annotation.text` is the TAL's bytes as written and
40
+ * is never trimmed (`api-types.md` says so of the field itself), so an event a scorer spelled
41
+ * `'Sleep stage W '` is not matched by `'Sleep stage W'`, and a query with its own stray space
42
+ * matches nothing. This docblock used to say "the exact trimmed text", which is neither what this
43
+ * function does nor what the field holds, and the failure it describes is silent: a padded
44
+ * vocabulary returns an empty list rather than an error (corrected in 0.3.51). For such a file,
45
+ * pass the predicate that says what you mean — `(text) => text.trim() === label`.
38
46
  */
39
47
  export declare function filterAnnotationsByText(annotations: readonly EdfAnnotation[], match: string | RegExp | ((text: string) => boolean)): readonly EdfAnnotation[];
40
48
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CAsB1B;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAA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
@@ -52,10 +52,18 @@ export function filterAnnotationsByTime(annotations, window) {
52
52
  /**
53
53
  * The annotations whose text matches.
54
54
  *
55
- * A string matches on the exact trimmed text, because annotation vocabularies are controlled —
55
+ * A string matches the text VERBATIM, because annotation vocabularies are controlled —
56
56
  * `Sleep stage W` is a fixed token, and a substring match on `W` would also catch `Sleep stage
57
57
  * REM` in files that spell it `W/REM`. Pass a predicate or a RegExp when you want something
58
58
  * looser; edfcore does not guess which you meant.
59
+ *
60
+ * Verbatim means verbatim, in both directions: `annotation.text` is the TAL's bytes as written and
61
+ * is never trimmed (`api-types.md` says so of the field itself), so an event a scorer spelled
62
+ * `'Sleep stage W '` is not matched by `'Sleep stage W'`, and a query with its own stray space
63
+ * matches nothing. This docblock used to say "the exact trimmed text", which is neither what this
64
+ * function does nor what the field holds, and the failure it describes is silent: a padded
65
+ * vocabulary returns an empty list rather than an error (corrected in 0.3.51). For such a file,
66
+ * pass the predicate that says what you mean — `(text) => text.trim() === label`.
59
67
  */
60
68
  export function filterAnnotationsByText(annotations, match) {
61
69
  const test = typeof match === 'string'
@@ -1 +1 @@
1
- {"version":3,"file":"annotations-query.js","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAqC,EACrC,MAA2B;IAE3B,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,EAAE,GAAG,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACzD,IAAI,EAAE,IAAI,IAAI;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEzC,OAAO,MAAM,CAAC,MAAM,CAClB,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,sBAAsB,CACpC,WAAqC;IAErC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CACxF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,WAAqC,EACrC,OAAe;IAEf,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,CAClB,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,yBAAyB,CAAC;QACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,IAAI,EAAE,CAAC;QAChD,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC/E,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
package/dist/cli-run.js CHANGED
@@ -51,7 +51,7 @@ Options
51
51
  --list list events one per line instead of counting (events)
52
52
  --limit <n> individual diagnostics or events to print (default 20)
53
53
 
54
- --version print the version and exit
54
+ --version, -v print the version and exit
55
55
 
56
56
  Exit codes: 0 success, 1 the file is unreadable or failed validation, 2 bad usage.
57
57
  `;
@@ -109,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
109
109
  readonly reserved: 224;
110
110
  };
111
111
  /** Published package version. Kept in sync with package.json by a test. */
112
- export declare const VERSION = "0.3.50";
112
+ export declare const VERSION = "0.3.52";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.3.50';
82
+ export const VERSION = '0.3.52';
83
83
  //# sourceMappingURL=constants.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.3.50",
3
+ "version": "0.3.52",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
@@ -61,10 +61,18 @@ export function filterAnnotationsByTime(
61
61
  /**
62
62
  * The annotations whose text matches.
63
63
  *
64
- * A string matches on the exact trimmed text, because annotation vocabularies are controlled —
64
+ * A string matches the text VERBATIM, because annotation vocabularies are controlled —
65
65
  * `Sleep stage W` is a fixed token, and a substring match on `W` would also catch `Sleep stage
66
66
  * REM` in files that spell it `W/REM`. Pass a predicate or a RegExp when you want something
67
67
  * looser; edfcore does not guess which you meant.
68
+ *
69
+ * Verbatim means verbatim, in both directions: `annotation.text` is the TAL's bytes as written and
70
+ * is never trimmed (`api-types.md` says so of the field itself), so an event a scorer spelled
71
+ * `'Sleep stage W '` is not matched by `'Sleep stage W'`, and a query with its own stray space
72
+ * matches nothing. This docblock used to say "the exact trimmed text", which is neither what this
73
+ * function does nor what the field holds, and the failure it describes is silent: a padded
74
+ * vocabulary returns an empty list rather than an error (corrected in 0.3.51). For such a file,
75
+ * pass the predicate that says what you mean — `(text) => text.trim() === label`.
68
76
  */
69
77
  export function filterAnnotationsByText(
70
78
  annotations: readonly EdfAnnotation[],
package/src/cli-run.ts CHANGED
@@ -62,7 +62,7 @@ Options
62
62
  --list list events one per line instead of counting (events)
63
63
  --limit <n> individual diagnostics or events to print (default 20)
64
64
 
65
- --version print the version and exit
65
+ --version, -v print the version and exit
66
66
 
67
67
  Exit codes: 0 success, 1 the file is unreadable or failed validation, 2 bad usage.
68
68
  `;
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.3.50';
96
+ export const VERSION = '0.3.52';