edfcore 0.6.250 → 0.6.251

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.
@@ -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.6.250";
112
+ export declare const VERSION = "0.6.251";
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.6.250';
82
+ export const VERSION = '0.6.251';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-annotations.d.ts","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AA4ED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CA8ER"}
1
+ {"version":3,"file":"format-annotations.d.ts","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,kGAAkG;IAClG,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AA4ED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,MAAM,CA0FR"}
@@ -99,13 +99,26 @@ export function formatAnnotations(annotations, options) {
99
99
  'must not be able to produce it. Next: pass the annotations from ' +
100
100
  'readAnnotations(recording, records).');
101
101
  }
102
- if (annotations.length === 0)
103
- return '';
102
+ /*
103
+ * The options BEFORE the empty list, so which of them a caller got wrong does not depend on the
104
+ * file. `formatValidationReport` states the rule one module over — its own `assertOptions` sits
105
+ * "outside the `diagnostics.length > 0` branch below" because "the typo belongs to the call, and
106
+ * the clean file is the cheap place to find out about it" — and this listing had the early return
107
+ * in front of all three of its guards.
108
+ *
109
+ * A recording with no events is the common one, not an edge case: most EDF files carry no
110
+ * annotations at all, and `readAnnotations` on a plain EDF file resolves to an empty list. So
111
+ * `formatAnnotations(annotations, 20)` — the bare number `assertOptions` exists for, which prints
112
+ * every one of fifty thousand events instead of twenty — was refused on the files that have
113
+ * events and accepted in silence on the files a caller develops against.
114
+ */
104
115
  assertOptions(options, 'formatAnnotations', 'annotation');
105
116
  // The flag, on the same rule as 0.6.182 and 0.6.193: `=== true` never coerces, so text read as
106
117
  // OFF and the `description@@channel` column a caller asked for was simply not there.
107
118
  requireBooleanOption(options?.includeChannel, 'includeChannel', 'the channel column was left off a listing that asked for it');
108
119
  const limit = requireItemLimit(options?.maxItems, annotations.length);
120
+ if (annotations.length === 0)
121
+ return '';
109
122
  /*
110
123
  * Both time columns are sized from the rows being printed, the way `formatHeader` sizes its
111
124
  * index column, because both can hold a value wider than a fixed width.
@@ -1 +1 @@
1
- {"version":3,"file":"format-annotations.js","sourceRoot":"","sources":["../src/format-annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM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C,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ 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.6.251
10
+
11
+ - **Fixed** `formatAnnotations` deciding whether to refuse a wrong options argument by looking at
12
+ the file. All three of its option guards sat behind `if (annotations.length === 0) return ''`, so
13
+ `formatAnnotations(annotations, 20)` — the bare number that prints every event instead of twenty —
14
+ was refused on a recording that carries events and accepted in silence on one that carries none.
15
+ A list, a string, `includeChannel: 'true'` and `maxItems: '20'` all read the same way.
16
+ - The empty list is the common case, not an edge case: most EDF files hold no annotations at all, so
17
+ the silent reading is the one a caller gets while the code is being written and the refusal arrives
18
+ later, from someone else's file.
19
+ - `formatValidationReport` already states the rule one module over — its own `assertOptions` sits
20
+ "outside the `diagnostics.length > 0` branch below" because "the typo belongs to the call, and the
21
+ clean file is the cheap place to find out about it".
22
+ - `formatAnnotations([])` with no options, with `{}`, with `null` or with `undefined` still returns
23
+ the empty string, and every message is unchanged.
24
+
9
25
  ## 0.6.250
10
26
 
11
27
  - **Fixed** `httpSource(url, [])` sending the request on the global `fetch`. The guard here was
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.250",
3
+ "version": "0.6.251",
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",
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.6.250';
96
+ export const VERSION = '0.6.251';
@@ -127,8 +127,19 @@ export function formatAnnotations(
127
127
  'readAnnotations(recording, records).',
128
128
  );
129
129
  }
130
- if (annotations.length === 0) return '';
131
-
130
+ /*
131
+ * The options BEFORE the empty list, so which of them a caller got wrong does not depend on the
132
+ * file. `formatValidationReport` states the rule one module over — its own `assertOptions` sits
133
+ * "outside the `diagnostics.length > 0` branch below" because "the typo belongs to the call, and
134
+ * the clean file is the cheap place to find out about it" — and this listing had the early return
135
+ * in front of all three of its guards.
136
+ *
137
+ * A recording with no events is the common one, not an edge case: most EDF files carry no
138
+ * annotations at all, and `readAnnotations` on a plain EDF file resolves to an empty list. So
139
+ * `formatAnnotations(annotations, 20)` — the bare number `assertOptions` exists for, which prints
140
+ * every one of fifty thousand events instead of twenty — was refused on the files that have
141
+ * events and accepted in silence on the files a caller develops against.
142
+ */
132
143
  assertOptions(options, 'formatAnnotations', 'annotation');
133
144
  // The flag, on the same rule as 0.6.182 and 0.6.193: `=== true` never coerces, so text read as
134
145
  // OFF and the `description@@channel` column a caller asked for was simply not there.
@@ -138,6 +149,7 @@ export function formatAnnotations(
138
149
  'the channel column was left off a listing that asked for it',
139
150
  );
140
151
  const limit = requireItemLimit(options?.maxItems, annotations.length);
152
+ if (annotations.length === 0) return '';
141
153
 
142
154
  /*
143
155
  * Both time columns are sized from the rows being printed, the way `formatHeader` sizes its