edfcore 0.4.38 → 0.4.40

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.
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/bytes/view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2BH;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAGxF;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAGvF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExF"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/bytes/view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+BH;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAGxF;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAGvF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAExF"}
@@ -19,10 +19,12 @@ function assertInBounds(bytes, offset, length) {
19
19
  'offset is computed by edfcore rather than passed in.');
20
20
  }
21
21
  if (!Number.isSafeInteger(length) || length < 0) {
22
- throw new RangeError(`byte length must be a non-negative safe integer, got ${length}`);
22
+ throw new RangeError(`byte length must be a non-negative safe integer, got ${length}. Next: report this — the ` +
23
+ 'length comes from the header layout, not from the call site.');
23
24
  }
24
25
  if (offset + length > bytes.length) {
25
- throw new RangeError(`byte range [${offset}, ${offset + length}) is outside the ${bytes.length}-byte buffer`);
26
+ throw new RangeError(`byte range [${offset}, ${offset + length}) is outside the ${bytes.length}-byte buffer. ` +
27
+ 'Next: check that the header and these bytes came from the same file.');
26
28
  }
27
29
  }
28
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/bytes/view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;GAKG;AACH,SAAS,cAAc,CAAC,KAAiB,EAAE,MAAc,EAAE,MAAc;IACvE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,UAAU,CAClB,wDAAwD,MAAM,4BAA4B;YACxF,sDAAsD,CACzD,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,UAAU,CAAC,wDAAwD,MAAM,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,IAAI,UAAU,CAClB,eAAe,MAAM,KAAK,MAAM,GAAG,MAAM,oBAAoB,KAAK,CAAC,MAAM,cAAc,CACxF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAiB,EAAE,MAAc,EAAE,MAAc;IAC1E,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,M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AC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAiB,EAAE,MAAc,EAAE,MAAc;IAC1E,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,MAAc,EAAE,MAAc;IACzE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB,EAAE,MAAc,EAAE,MAAc;IAC9E,OAAO,kBAAkB,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -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.4.38";
112
+ export declare const VERSION = "0.4.40";
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.4.38';
82
+ export const VERSION = '0.4.40';
83
83
  //# sourceMappingURL=constants.js.map
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,17 @@ 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.4.40
10
+
11
+ - **Fixed** the last refusal in `assertInBounds` without a `Next:` clause, and the one of the
12
+ three with a cause a caller can act on: its own docblock says this fires when a header is mixed
13
+ with bytes from another file, which the message never passed on.
14
+
15
+ ## 0.4.39
16
+
17
+ - **Fixed** the byte-length bounds refusal, the sibling of the one 0.4.38 fixed and the second of
18
+ three in `assertInBounds` without a `Next:` clause.
19
+
9
20
  ## 0.4.38
10
21
 
11
22
  - **Fixed** the byte-offset bounds refusal in `bytes/view.ts` carrying no `Next:` clause. Nothing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.4.38",
3
+ "version": "0.4.40",
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/bytes/view.ts CHANGED
@@ -23,11 +23,15 @@ function assertInBounds(bytes: Uint8Array, offset: number, length: number): void
23
23
  );
24
24
  }
25
25
  if (!Number.isSafeInteger(length) || length < 0) {
26
- throw new RangeError(`byte length must be a non-negative safe integer, got ${length}`);
26
+ throw new RangeError(
27
+ `byte length must be a non-negative safe integer, got ${length}. Next: report this — the ` +
28
+ 'length comes from the header layout, not from the call site.',
29
+ );
27
30
  }
28
31
  if (offset + length > bytes.length) {
29
32
  throw new RangeError(
30
- `byte range [${offset}, ${offset + length}) is outside the ${bytes.length}-byte buffer`,
33
+ `byte range [${offset}, ${offset + length}) is outside the ${bytes.length}-byte buffer. ` +
34
+ 'Next: check that the header and these bytes came from the same file.',
31
35
  );
32
36
  }
33
37
  }
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.4.38';
96
+ export const VERSION = '0.4.40';