edfcore 0.6.284 → 0.6.286
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/annotations-query.d.ts.map +1 -1
- package/dist/annotations-query.js +12 -2
- package/dist/annotations-query.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/header/lookup.d.ts +15 -0
- package/dist/header/lookup.d.ts.map +1 -1
- package/dist/header/lookup.js +38 -1
- package/dist/header/lookup.js.map +1 -1
- package/docs/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/src/annotations-query.ts +12 -2
- package/src/constants.ts +1 -1
- package/src/header/lookup.ts +47 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAmDrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CA6E1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"annotations-query.d.ts","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAmDrE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,MAAM,EAAE,mBAAmB,GAC1B,SAAS,aAAa,EAAE,CA6E1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GACnD,SAAS,aAAa,EAAE,CAwD1B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,SAAS,aAAa,EAAE,GACpC,aAAa,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CASlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,OAAO,EAAE,MAAM,GACd,SAAS,aAAa,EAAE,CA2B1B"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* one puts events in the neighbouring window on exactly the files that bother to state their
|
|
19
19
|
* offset.
|
|
20
20
|
*/
|
|
21
|
-
import { assertMatcher, matchesText } from './header/lookup.js';
|
|
21
|
+
import { assertMatcher, isRegExpMatcher, matchesText } from './header/lookup.js';
|
|
22
22
|
import { secondsToTicks } from './tal/ticks.js';
|
|
23
23
|
import { describeValue } from './text/describe.js';
|
|
24
24
|
/**
|
|
@@ -166,9 +166,19 @@ export function filterAnnotationsByText(annotations, match) {
|
|
|
166
166
|
assertAnnotations(annotations, 'filterAnnotationsByText');
|
|
167
167
|
const test = typeof match === 'string'
|
|
168
168
|
? (text) => text === match
|
|
169
|
-
: match
|
|
169
|
+
: isRegExpMatcher(match)
|
|
170
170
|
? // Not `match.test` directly: a `g` or `y` flag makes `test` stateful across the array
|
|
171
171
|
// and silently returns about half the true matches. See `matchesText`.
|
|
172
|
+
//
|
|
173
|
+
// `isRegExpMatcher`, not `instanceof RegExp`, which was false for a pattern built in
|
|
174
|
+
// another realm — an iframe, a worker, an Electron contextBridge, jsdom, a Node `vm`
|
|
175
|
+
// context. 0.6.285 fixed the same dispatch in `matchSignals` and has the argument; this
|
|
176
|
+
// is the second of the two calls that share the rule, and the likelier of them to be
|
|
177
|
+
// running inside a worker, since narrowing a hypnogram to its stages is the work a viewer
|
|
178
|
+
// moves off the main thread. A cross-realm `/stage/i` was refused as "the matcher is the
|
|
179
|
+
// RegExp /stage/i, and this call takes a string matched verbatim, a RegExp, or a
|
|
180
|
+
// predicate on the text" — a sentence whose rule the argument satisfies, from a guard
|
|
181
|
+
// whose subject `describeValue` had already read off the same tag (0.6.286).
|
|
172
182
|
matchesText(match)
|
|
173
183
|
: assertMatcher(match, 'filterAnnotationsByText', 'a string matched verbatim, a RegExp, or a predicate on the text', 'pass the label as a string, or (text) => text.trim() === label for a file whose ' +
|
|
174
184
|
'vocabulary is padded');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations-query.js","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations-query.js","sourceRoot":"","sources":["../src/annotations-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;;GAYG;AACH,SAAS,iBAAiB,CAAC,WAAqC,EAAE,IAAY;IAC5E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAClB,GAAG,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AE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CACxF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,WAAqC,EACrC,OAAe;IAEf,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAChD;;;;;;OAMG;IACH,MAAM,KAAK,GAAG,OAAmF,CAAC;IAClG,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,IAAI,cAAc,IAAI,KAAK,IAAI,iBAAiB,IAAI,KAAK,EAAE,CAAC;YAC1D,MAAM,IAAI,UAAU,CAClB,2FAA2F;gBACzF,yEAAyE;gBACzE,wFAAwF,CAC3F,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9C,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/constants.d.ts
CHANGED
|
@@ -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.
|
|
112
|
+
export declare const VERSION = "0.6.286";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
package/dist/header/lookup.d.ts
CHANGED
|
@@ -61,6 +61,21 @@ export declare function getSignal(header: EdfHeader, selector: number | string):
|
|
|
61
61
|
* 0.6.103).
|
|
62
62
|
*/
|
|
63
63
|
export declare function assertMatcher<T>(match: T, call: string, accepts: string, instead: string): T;
|
|
64
|
+
/**
|
|
65
|
+
* Whether a matcher is a RegExp, by the built-in tag.
|
|
66
|
+
*
|
|
67
|
+
* `instanceof RegExp` is false for a pattern built in another realm — an iframe, a worker, an
|
|
68
|
+
* Electron contextBridge, jsdom, a Node `vm` context — which is the rule `io/bytes.ts`,
|
|
69
|
+
* `bytes/latin1.ts`, `io/source.ts`, `decode/digital.ts` and `errors.ts` each state for their own
|
|
70
|
+
* guard, and `text/describe.ts` applied to its buffer arm in 0.6.284. A tag comes from
|
|
71
|
+
* `Symbol.toStringTag` on the prototype and every realm agrees on it.
|
|
72
|
+
*
|
|
73
|
+
* One home for the two calls that dispatch on it, `matchSignals` here and `filterAnnotationsByText`
|
|
74
|
+
* next door, for the reason 0.6.121 gives for `isByteArray`: two copies of a rule have to be kept
|
|
75
|
+
* in agreement and one does not. A type guard rather than a bare comparison, so the `else` branch
|
|
76
|
+
* still narrows to the predicate (0.6.285).
|
|
77
|
+
*/
|
|
78
|
+
export declare function isRegExpMatcher(match: unknown): match is RegExp;
|
|
64
79
|
export declare function matchesText(match: RegExp): (text: string) => boolean;
|
|
65
80
|
/**
|
|
66
81
|
* Every data signal whose label matches a pattern.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/header/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAA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;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAM5F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAQpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAC3C,SAAS,SAAS,EAAE,CAiEtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAoDjE"}
|
package/dist/header/lookup.js
CHANGED
|
@@ -296,6 +296,23 @@ export function assertMatcher(match, call, accepts, instead) {
|
|
|
296
296
|
throw new RangeError(`${call}(): the matcher is ${describeValue(match)}, and this call takes ${accepts}. ` +
|
|
297
297
|
`Next: ${instead}.`);
|
|
298
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Whether a matcher is a RegExp, by the built-in tag.
|
|
301
|
+
*
|
|
302
|
+
* `instanceof RegExp` is false for a pattern built in another realm — an iframe, a worker, an
|
|
303
|
+
* Electron contextBridge, jsdom, a Node `vm` context — which is the rule `io/bytes.ts`,
|
|
304
|
+
* `bytes/latin1.ts`, `io/source.ts`, `decode/digital.ts` and `errors.ts` each state for their own
|
|
305
|
+
* guard, and `text/describe.ts` applied to its buffer arm in 0.6.284. A tag comes from
|
|
306
|
+
* `Symbol.toStringTag` on the prototype and every realm agrees on it.
|
|
307
|
+
*
|
|
308
|
+
* One home for the two calls that dispatch on it, `matchSignals` here and `filterAnnotationsByText`
|
|
309
|
+
* next door, for the reason 0.6.121 gives for `isByteArray`: two copies of a rule have to be kept
|
|
310
|
+
* in agreement and one does not. A type guard rather than a bare comparison, so the `else` branch
|
|
311
|
+
* still narrows to the predicate (0.6.285).
|
|
312
|
+
*/
|
|
313
|
+
export function isRegExpMatcher(match) {
|
|
314
|
+
return Object.prototype.toString.call(match) === '[object RegExp]';
|
|
315
|
+
}
|
|
299
316
|
export function matchesText(match) {
|
|
300
317
|
const pattern = new RegExp(match.source, match.flags);
|
|
301
318
|
return (text) => {
|
|
@@ -320,7 +337,27 @@ export function matchesText(match) {
|
|
|
320
337
|
export function matchSignals(header, match) {
|
|
321
338
|
assertHeaderSignals(header, 'matchSignals');
|
|
322
339
|
assertSelector(match, 'matchSignals', 'a RegExp, or a function taking a label');
|
|
323
|
-
|
|
340
|
+
/*
|
|
341
|
+
* The TAG, not `instanceof`, which refused a RegExp by naming it a RegExp.
|
|
342
|
+
*
|
|
343
|
+
* `instanceof RegExp` is false for a pattern built in another realm — an iframe, a worker, an
|
|
344
|
+
* Electron contextBridge, jsdom, a Node `vm` context — so a cross-realm `/EEG/i` fell to
|
|
345
|
+
* `assertMatcher`, which wants a function, and was refused with "the matcher is the RegExp /EEG/i,
|
|
346
|
+
* and this call takes a RegExp or a predicate on the label. Next: pass a RegExp for a pattern".
|
|
347
|
+
* The subject is right because `describeValue` reads the tag (0.6.269); the rule and the advice
|
|
348
|
+
* then both describe what the caller had already done.
|
|
349
|
+
*
|
|
350
|
+
* Nothing below needs changing for it to work: `matchesText` recompiles from `.source` and
|
|
351
|
+
* `.flags`, which every realm spells the same, so the pattern this dispatch was keeping out was
|
|
352
|
+
* one the matcher could always have used.
|
|
353
|
+
*
|
|
354
|
+
* The rule is the package's own, stated in `io/bytes.ts`, `bytes/latin1.ts`, `io/source.ts`,
|
|
355
|
+
* `decode/digital.ts`, `errors.ts` and `text/describe.ts`, and extended to the describer's buffer
|
|
356
|
+
* arm in 0.6.284. A montage selector is the likeliest cross-realm matcher there is: the browser
|
|
357
|
+
* inspector in `website/` is where one is typed, and a worker is where the filtering goes
|
|
358
|
+
* (0.6.285).
|
|
359
|
+
*/
|
|
360
|
+
const test = isRegExpMatcher(match)
|
|
324
361
|
? matchesText(match)
|
|
325
362
|
: assertMatcher(match, 'matchSignals', 'a RegExp or a predicate on the label', 'pass a RegExp for a pattern, or findSignals(header, label) for an exact label — the ' +
|
|
326
363
|
'case this function deliberately does not cover');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../src/header/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,+FAA+F;IAC/F,0FAA0F;IAC1F,+FAA+F;IAC/F,sBAAsB;IACtB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CAClB,qCAAqC,aAAa,CAAC,KAAK,CAAC,6BAA6B;YACpF,mDAAmD,CACtD,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,OAAO,KAAK,qBAAqB,IAAI,OAAO,KAAK,qBAAqB,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,cAAc,CAAC,QAAiB,EAAE,IAAY,EAAE,OAAe;IACtE,IAAI,QAAQ,KAAK,SAAS,I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
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.286
|
|
10
|
+
|
|
11
|
+
- **Fixed** the second of the two calls that dispatched on `match instanceof RegExp`.
|
|
12
|
+
`filterAnnotationsByText` refused a RegExp built in another realm the same way `matchSignals` did
|
|
13
|
+
before 0.6.285 — "the matcher is the RegExp /stage/i, and this call takes a string matched
|
|
14
|
+
verbatim, a RegExp, or a predicate on the text" — naming the kind it had just refused, because
|
|
15
|
+
`describeValue` reads the built-in tag the dispatch would not.
|
|
16
|
+
- This is the likelier of the two to be running across a realm boundary. `annotations-query.ts` is
|
|
17
|
+
Layer 7 and pure, so narrowing a hypnogram to its stages is work a viewer can move into a worker,
|
|
18
|
+
and the pattern is then built there.
|
|
19
|
+
- The verbatim-string and predicate forms were never affected: `typeof` is realm-agnostic. Both calls
|
|
20
|
+
now share `isRegExpMatcher`.
|
|
21
|
+
|
|
22
|
+
## 0.6.285
|
|
23
|
+
|
|
24
|
+
- **Fixed** `matchSignals` refusing a RegExp built in another realm — an iframe, a worker, an Electron
|
|
25
|
+
contextBridge, jsdom, a Node `vm` context — with a message that named it a RegExp: "the matcher is
|
|
26
|
+
the RegExp /EEG/i, and this call takes a RegExp or a predicate on the label. Next: pass a RegExp for
|
|
27
|
+
a pattern". Every clause of that is true of what the caller did.
|
|
28
|
+
- The dispatch said `match instanceof RegExp`, which is false across a realm boundary, so the pattern
|
|
29
|
+
fell through to the branch that wants a function. The subject was right because `describeValue` has
|
|
30
|
+
read the built-in tag since 0.6.269, so one half of `header/lookup.ts` could name the value a RegExp
|
|
31
|
+
while the half beside it decided it was not one.
|
|
32
|
+
- Nothing in the matching needed changing: `matchesText` recompiles from `.source` and `.flags`, which
|
|
33
|
+
every realm spells the same, so the dispatch was keeping out a pattern the matcher could always have
|
|
34
|
+
used.
|
|
35
|
+
- The rule now lives in one place, `isRegExpMatcher`, for the two calls that dispatch on it.
|
|
36
|
+
|
|
9
37
|
## 0.6.284
|
|
10
38
|
|
|
11
39
|
- **Fixed** `describeValue` naming an `ArrayBuffer` from another realm "an object". `ArrayBuffer.isView`
|
package/package.json
CHANGED
package/src/annotations-query.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* offset.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { assertMatcher, matchesText } from './header/lookup.js';
|
|
22
|
+
import { assertMatcher, isRegExpMatcher, matchesText } from './header/lookup.js';
|
|
23
23
|
import { secondsToTicks } from './tal/ticks.js';
|
|
24
24
|
import { describeValue } from './text/describe.js';
|
|
25
25
|
import type { EdfAnnotation, EdfAnnotationWindow } from './types.js';
|
|
@@ -187,9 +187,19 @@ export function filterAnnotationsByText(
|
|
|
187
187
|
const test =
|
|
188
188
|
typeof match === 'string'
|
|
189
189
|
? (text: string): boolean => text === match
|
|
190
|
-
: match
|
|
190
|
+
: isRegExpMatcher(match)
|
|
191
191
|
? // Not `match.test` directly: a `g` or `y` flag makes `test` stateful across the array
|
|
192
192
|
// and silently returns about half the true matches. See `matchesText`.
|
|
193
|
+
//
|
|
194
|
+
// `isRegExpMatcher`, not `instanceof RegExp`, which was false for a pattern built in
|
|
195
|
+
// another realm — an iframe, a worker, an Electron contextBridge, jsdom, a Node `vm`
|
|
196
|
+
// context. 0.6.285 fixed the same dispatch in `matchSignals` and has the argument; this
|
|
197
|
+
// is the second of the two calls that share the rule, and the likelier of them to be
|
|
198
|
+
// running inside a worker, since narrowing a hypnogram to its stages is the work a viewer
|
|
199
|
+
// moves off the main thread. A cross-realm `/stage/i` was refused as "the matcher is the
|
|
200
|
+
// RegExp /stage/i, and this call takes a string matched verbatim, a RegExp, or a
|
|
201
|
+
// predicate on the text" — a sentence whose rule the argument satisfies, from a guard
|
|
202
|
+
// whose subject `describeValue` had already read off the same tag (0.6.286).
|
|
193
203
|
matchesText(match)
|
|
194
204
|
: assertMatcher(
|
|
195
205
|
match,
|
package/src/constants.ts
CHANGED
package/src/header/lookup.ts
CHANGED
|
@@ -330,6 +330,24 @@ export function assertMatcher<T>(match: T, call: string, accepts: string, instea
|
|
|
330
330
|
);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Whether a matcher is a RegExp, by the built-in tag.
|
|
335
|
+
*
|
|
336
|
+
* `instanceof RegExp` is false for a pattern built in another realm — an iframe, a worker, an
|
|
337
|
+
* Electron contextBridge, jsdom, a Node `vm` context — which is the rule `io/bytes.ts`,
|
|
338
|
+
* `bytes/latin1.ts`, `io/source.ts`, `decode/digital.ts` and `errors.ts` each state for their own
|
|
339
|
+
* guard, and `text/describe.ts` applied to its buffer arm in 0.6.284. A tag comes from
|
|
340
|
+
* `Symbol.toStringTag` on the prototype and every realm agrees on it.
|
|
341
|
+
*
|
|
342
|
+
* One home for the two calls that dispatch on it, `matchSignals` here and `filterAnnotationsByText`
|
|
343
|
+
* next door, for the reason 0.6.121 gives for `isByteArray`: two copies of a rule have to be kept
|
|
344
|
+
* in agreement and one does not. A type guard rather than a bare comparison, so the `else` branch
|
|
345
|
+
* still narrows to the predicate (0.6.285).
|
|
346
|
+
*/
|
|
347
|
+
export function isRegExpMatcher(match: unknown): match is RegExp {
|
|
348
|
+
return Object.prototype.toString.call(match) === '[object RegExp]';
|
|
349
|
+
}
|
|
350
|
+
|
|
333
351
|
export function matchesText(match: RegExp): (text: string) => boolean {
|
|
334
352
|
const pattern = new RegExp(match.source, match.flags);
|
|
335
353
|
return (text: string): boolean => {
|
|
@@ -358,16 +376,35 @@ export function matchSignals(
|
|
|
358
376
|
): readonly EdfSignal[] {
|
|
359
377
|
assertHeaderSignals(header, 'matchSignals');
|
|
360
378
|
assertSelector(match, 'matchSignals', 'a RegExp, or a function taking a label');
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
379
|
+
/*
|
|
380
|
+
* The TAG, not `instanceof`, which refused a RegExp by naming it a RegExp.
|
|
381
|
+
*
|
|
382
|
+
* `instanceof RegExp` is false for a pattern built in another realm — an iframe, a worker, an
|
|
383
|
+
* Electron contextBridge, jsdom, a Node `vm` context — so a cross-realm `/EEG/i` fell to
|
|
384
|
+
* `assertMatcher`, which wants a function, and was refused with "the matcher is the RegExp /EEG/i,
|
|
385
|
+
* and this call takes a RegExp or a predicate on the label. Next: pass a RegExp for a pattern".
|
|
386
|
+
* The subject is right because `describeValue` reads the tag (0.6.269); the rule and the advice
|
|
387
|
+
* then both describe what the caller had already done.
|
|
388
|
+
*
|
|
389
|
+
* Nothing below needs changing for it to work: `matchesText` recompiles from `.source` and
|
|
390
|
+
* `.flags`, which every realm spells the same, so the pattern this dispatch was keeping out was
|
|
391
|
+
* one the matcher could always have used.
|
|
392
|
+
*
|
|
393
|
+
* The rule is the package's own, stated in `io/bytes.ts`, `bytes/latin1.ts`, `io/source.ts`,
|
|
394
|
+
* `decode/digital.ts`, `errors.ts` and `text/describe.ts`, and extended to the describer's buffer
|
|
395
|
+
* arm in 0.6.284. A montage selector is the likeliest cross-realm matcher there is: the browser
|
|
396
|
+
* inspector in `website/` is where one is typed, and a worker is where the filtering goes
|
|
397
|
+
* (0.6.285).
|
|
398
|
+
*/
|
|
399
|
+
const test = isRegExpMatcher(match)
|
|
400
|
+
? matchesText(match)
|
|
401
|
+
: assertMatcher(
|
|
402
|
+
match,
|
|
403
|
+
'matchSignals',
|
|
404
|
+
'a RegExp or a predicate on the label',
|
|
405
|
+
'pass a RegExp for a pattern, or findSignals(header, label) for an exact label — the ' +
|
|
406
|
+
'case this function deliberately does not cover',
|
|
407
|
+
);
|
|
371
408
|
/*
|
|
372
409
|
* An ASYNC predicate, which matches EVERYTHING.
|
|
373
410
|
*
|