edfcore 0.6.283 → 0.6.284

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.283";
112
+ export declare const VERSION = "0.6.284";
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.283';
82
+ export const VERSION = '0.6.284';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/text/describe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA2DpD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAC/E,MAAM,CAER"}
1
+ {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/text/describe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAyEpD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAC/E,MAAM,CAER"}
@@ -34,9 +34,21 @@ export function describeValue(value) {
34
34
  * `decodeHeaderLatin1(buffer)` is a fetch result, and "an object" says nothing a reader can act
35
35
  * on. The tag, not `instanceof`: it is the same across realms, which is why `io/bytes.ts` uses it
36
36
  * too. Never the contents (0.6.116).
37
+ *
38
+ * The buffer half of that said `instanceof` anyway, which is the defect `io/bytes.ts` describes
39
+ * in those same words and fixed in its own guard in 0.3.20: an ArrayBuffer from another realm —
40
+ * an iframe, an Electron contextBridge, jsdom, a Node `vm` context — is a "real, fully usable
41
+ * ArrayBuffer", and `byteSource` accepts one. This module then could not name the thing the
42
+ * package next door takes, so `toPhysical(signal, thatBuffer)` was refused as "an object" while
43
+ * the identical buffer from this realm was refused as "ArrayBuffer". `SharedArrayBuffer` comes
44
+ * with it, because `byteSource` admits that tag too. Inlined rather than imported: layer 1
45
+ * cannot reach layer 5 (0.6.284).
37
46
  */
38
- if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {
39
- return Object.prototype.toString.call(value).slice(8, -1);
47
+ const tag = Object.prototype.toString.call(value);
48
+ if (ArrayBuffer.isView(value) ||
49
+ tag === '[object ArrayBuffer]' ||
50
+ tag === '[object SharedArrayBuffer]') {
51
+ return tag.slice(8, -1);
40
52
  }
41
53
  /*
42
54
  * A REGEXP, by the same tag, for the same reason, in the place it is likeliest to turn up.
@@ -54,7 +66,7 @@ export function describeValue(value) {
54
66
  * `String(value)` is the source as written — `/EEG/i` — which is the whole of what a reader needs
55
67
  * to recognise it, and it is a pattern they typed rather than data read out of a file.
56
68
  */
57
- if (Object.prototype.toString.call(value) === '[object RegExp]') {
69
+ if (tag === '[object RegExp]') {
58
70
  return `the RegExp ${String(value)}`;
59
71
  }
60
72
  /*
@@ -1 +1 @@
1
- {"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/text/describe.ts"],"names":[],"mappings":"AAAA;;;;;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AK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,OAAO,KAAK,EAAE,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAgF;IAEhF,OAAO,YAAY,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC;AAC5F,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.284
10
+
11
+ - **Fixed** `describeValue` naming an `ArrayBuffer` from another realm "an object". `ArrayBuffer.isView`
12
+ is a brand check and so is realm-safe, but the buffer arm beside it said `instanceof ArrayBuffer`,
13
+ which is false for a buffer that crossed an iframe, an Electron contextBridge, jsdom or a Node `vm`
14
+ boundary.
15
+ - `byteSource` takes such a buffer: `io/bytes.ts` has matched the built-in tag since 0.3.20, and its
16
+ docblock calls one "a real, fully usable ArrayBuffer from another realm". So the package accepted the
17
+ buffer at the door and could not name it at any of the roughly forty guards that read their subject
18
+ out of `describeValue` — `toPhysical(signal, buffer)` was refused as "the samples are an object"
19
+ while the identical buffer built in this realm was refused as "the samples are ArrayBuffer".
20
+ - The describer's own docblock has stated the rule since 0.6.116 — "The tag, not `instanceof`: it is
21
+ the same across realms, which is why `io/bytes.ts` uses it too" — three lines above the branch that
22
+ did not follow it.
23
+ - `SharedArrayBuffer` is named too, because `byteSource` admits that tag as well.
24
+
9
25
  ## 0.6.283
10
26
 
11
27
  - **Fixed** `trimToWindow` answering with an empty signal for a channel that declares no samples per
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.283",
3
+ "version": "0.6.284",
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.283';
96
+ export const VERSION = '0.6.284';
@@ -30,9 +30,23 @@ export function describeValue(value: unknown): string {
30
30
  * `decodeHeaderLatin1(buffer)` is a fetch result, and "an object" says nothing a reader can act
31
31
  * on. The tag, not `instanceof`: it is the same across realms, which is why `io/bytes.ts` uses it
32
32
  * too. Never the contents (0.6.116).
33
+ *
34
+ * The buffer half of that said `instanceof` anyway, which is the defect `io/bytes.ts` describes
35
+ * in those same words and fixed in its own guard in 0.3.20: an ArrayBuffer from another realm —
36
+ * an iframe, an Electron contextBridge, jsdom, a Node `vm` context — is a "real, fully usable
37
+ * ArrayBuffer", and `byteSource` accepts one. This module then could not name the thing the
38
+ * package next door takes, so `toPhysical(signal, thatBuffer)` was refused as "an object" while
39
+ * the identical buffer from this realm was refused as "ArrayBuffer". `SharedArrayBuffer` comes
40
+ * with it, because `byteSource` admits that tag too. Inlined rather than imported: layer 1
41
+ * cannot reach layer 5 (0.6.284).
33
42
  */
34
- if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) {
35
- return Object.prototype.toString.call(value).slice(8, -1);
43
+ const tag = Object.prototype.toString.call(value);
44
+ if (
45
+ ArrayBuffer.isView(value) ||
46
+ tag === '[object ArrayBuffer]' ||
47
+ tag === '[object SharedArrayBuffer]'
48
+ ) {
49
+ return tag.slice(8, -1);
36
50
  }
37
51
  /*
38
52
  * A REGEXP, by the same tag, for the same reason, in the place it is likeliest to turn up.
@@ -50,7 +64,7 @@ export function describeValue(value: unknown): string {
50
64
  * `String(value)` is the source as written — `/EEG/i` — which is the whole of what a reader needs
51
65
  * to recognise it, and it is a pattern they typed rather than data read out of a file.
52
66
  */
53
- if (Object.prototype.toString.call(value) === '[object RegExp]') {
67
+ if (tag === '[object RegExp]') {
54
68
  return `the RegExp ${String(value)}`;
55
69
  }
56
70
  /*