edfcore 0.6.91 → 0.6.93

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.91";
112
+ export declare const VERSION = "0.6.93";
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.91';
82
+ export const VERSION = '0.6.93';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/header/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGxD;AAwBD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,SAAS,EAAE,CAIlF;AA6CD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAuCjF;AAED;;;;;;;;;;;;;;GAcG;AACH,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,CAMtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEjE"}
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../src/header/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGxD;AAwBD,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,SAAS,EAAE,CAIlF;AA6CD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgDjF;AAED;;;;;;;;;;;;;;GAcG;AACH,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,CAMtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEjE"}
@@ -103,8 +103,15 @@ export function getSignal(header, selector) {
103
103
  const signal = header.signals[selector];
104
104
  if (signal !== undefined)
105
105
  return signal;
106
- throw new EdfChannelNotFoundError(`signal index ${selector} is outside the ${header.signals.length} signals this file ` +
107
- `declares. Labels, in signal order: ${quoteLabels(header)}. Next: pass an index in ` +
106
+ /*
107
+ * A fractional index is not "outside" anything. `getSignal(header, 1.5)` which is what a
108
+ * midpoint, an average or a division by a sample rate produces — was told it "is outside the 7
109
+ * signals this file declares. Next: pass an index in 0..6", and 1.5 already is one: the message
110
+ * named a rule the rejected value satisfies (fixed in 0.6.93).
111
+ */
112
+ throw new EdfChannelNotFoundError(`signal index ${selector} ${Number.isInteger(selector)
113
+ ? `is outside the ${header.signals.length} signals this file declares`
114
+ : 'is not a whole number, so it falls between two signals rather than outside them'}. Labels, in signal order: ${quoteLabels(header)}. Next: pass a whole index in ` +
108
115
  `0..${header.signals.length - 1}, or a label.`, { selector, availableLabels: header.signals.map((signal) => signal.label) });
109
116
  }
110
117
  const matches = findSignals(header, selector);
@@ -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;AAGjD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,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,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO;IACxD,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,uBAAuB,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC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CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAChF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,OAAO,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACjF,CAAC"}
@@ -90,28 +90,5 @@ export declare function ceilDiv(a: bigint, b: bigint): bigint;
90
90
  * that accepts exponent notation, so three bytes are enough to ask for it.
91
91
  */
92
92
  export declare function saturateToInt64(ticks: bigint): bigint;
93
- /**
94
- * Seconds to ticks, rounded to the NEAREST tick (ties away from zero is not required; ties go
95
- * toward +Infinity, as `Math.round` does).
96
- *
97
- * Only for user-supplied bounds such as a time window, never for a value read from disk: a
98
- * caller's `30.0` must resolve to 300000000 ticks and not to 299999999 because `30 * 1e7` landed
99
- * one ULP low. On-disk values reach ticks through the digit parsers above, which never round.
100
- *
101
- * Throws `RangeError` for a non-finite argument: there is no tick count for NaN or Infinity, and
102
- * inventing 0 would silently move a window to the file start.
103
- *
104
- * `name` is the caller's own word for the value, and it is required rather than defaulted. The
105
- * message used to end "check the window bound you passed in", which is right for five of the
106
- * fifteen call sites and wrong for the rest: nine of them convert an INSTANT — a cursor position,
107
- * a record onset, a sample start — and one converts `secondsPerBucket`, so a caller who passed a
108
- * `NaN` bucket width was sent to look at their window (fixed in 0.6.30).
109
- *
110
- * It is the pair `options.ts` documents from the other side: "One bad option, two different wrong
111
- * diagnoses. Resolving it in one place means the message names the argument that is actually
112
- * wrong." `resolveSignals` reached the same place by the opposite route and carries NO caller
113
- * prefix, "because a hard-coded name would be wrong for all but one of them" — which is the choice
114
- * available when the callers cannot say. These can.
115
- */
116
93
  export declare function secondsToTicks(seconds: number, name: string): bigint;
117
94
  //# sourceMappingURL=ticks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../src/tal/ticks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAwED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAOxD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAQ1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGpD;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASpE"}
1
+ {"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../src/tal/ticks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAwED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAOxD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAQ1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGpD;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AAwCD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBpE"}
package/dist/tal/ticks.js CHANGED
@@ -189,7 +189,32 @@ export function saturateToInt64(ticks) {
189
189
  * prefix, "because a hard-coded name would be wrong for all but one of them" — which is the choice
190
190
  * available when the callers cannot say. These can.
191
191
  */
192
+ /**
193
+ * A value that is not a number at all, said in a way that does not read as a valid one.
194
+ *
195
+ * The template below interpolated it bare, so the message named a rule the printed value satisfies.
196
+ * A BigInt is the sharp case: this package hands out `onsetTicksFromFirstRecord` and every other
197
+ * instant as ticks, and passing one where seconds belong earned "startSeconds must be a finite
198
+ * number of seconds, but was 10000000" — which is a finite number of seconds (fixed in 0.6.92).
199
+ */
200
+ function describeSeconds(seconds) {
201
+ if (typeof seconds === 'bigint')
202
+ return `the BigInt ${seconds}n`;
203
+ if (typeof seconds === 'string')
204
+ return `the string ${JSON.stringify(seconds)}`;
205
+ if (seconds === null)
206
+ return 'null';
207
+ return typeof seconds === 'object' ? 'an object' : `a ${typeof seconds}`;
208
+ }
192
209
  export function secondsToTicks(seconds, name) {
210
+ // Separated from the finiteness check below so that neither message can describe the other's
211
+ // value: "not finite" is about a number, and `NaN`, `Infinity` and `undefined` all read correctly
212
+ // as themselves. A string or a BigInt does not.
213
+ if (typeof seconds !== 'number' && seconds !== undefined) {
214
+ throw new RangeError(`${name} must be a number of seconds, and was given ${describeSeconds(seconds)}. Next: ` +
215
+ 'convert it first — Number(text) for a string, and for a tick count the matching ' +
216
+ '*Seconds field beside it, which every instant edfcore hands out carries.');
217
+ }
193
218
  if (!Number.isFinite(seconds)) {
194
219
  throw new RangeError(`${name} must be a finite number of seconds, but was ${seconds}. Next: check the ` +
195
220
  'expression that produced it — Number() on an absent environment variable, query ' +
@@ -1 +1 @@
1
- {"version":3,"file":"ticks.js","sourceRoot":"","sources":["../../src/tal/ticks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAoBnD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,gGAAgG;AAChG,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAQxD,MAAM,gBAAgB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OAAO,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACpC,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,OAAO,OAAO,EAAE,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,IAAY;IAC1D,6FAA6F;IAC7F,kGAAkG;IAClG,gDAAgD;IAChD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACzD,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,+CAA+C,eAAe,CAAC,OAAO,CAAC,UAAU;YACtF,kFAAkF;YAClF,0EAA0E,CAC7E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CAClB,GAAG,IAAI,gDAAgD,OAAO,oBAAoB;YAChF,kFAAkF;YAClF,6EAA6E,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,sBAAsB,CAAC,CAAC,CAAC;AAC9D,CAAC"}
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,31 @@ 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.93
10
+
11
+ - **Changed** what `getSignal(header, 1.5)` says. `header.signals[1.5]` is `undefined`, so a
12
+ fractional index took the branch an out-of-range one takes and was told it "is outside the 7
13
+ signals this file declares. Next: pass an index in 0..6" — which 1.5 already is.
14
+ - The one thing wrong with it, that it is not whole, was the one thing the message did not say. It
15
+ now reads "is not a whole number, so it falls between two signals rather than outside them", and
16
+ the `Next:` clause asks for a whole index — which is what an out-of-range integer needs too.
17
+ - A midpoint between two channels, an average, and anything divided by a sample rate all produce
18
+ one. Same shape of defect as 0.6.92 in the time layer, one module over.
19
+
20
+ ## 0.6.92
21
+
22
+ - **Changed** how a time argument that is not a number at all is refused, because the old message
23
+ named a rule the printed value satisfies.
24
+ - `secondsToTicks` interpolated the value bare into "must be a finite number of seconds, but was
25
+ ${seconds}". `NaN`, `Infinity` and `undefined` read correctly there; nothing else did. The string
26
+ `'0'` came out as `but was 0` — 0 is a finite number of seconds.
27
+ - A BigInt is the case worth fixing for. Every instant this package hands out is ticks
28
+ (`onsetTicksFromFirstRecord`, `spanTicks`, `index.onsetTicks()`), so passing one back where
29
+ seconds belong is a mistake the API's own shape invites, and it earned "but was 10000000" — a
30
+ finite number of seconds, from a value out by a factor of ten million. It now says "was given the
31
+ BigInt 10000000n", and points at the `*Seconds` field beside it — every instant edfcore hands out
32
+ carries both.
33
+
9
34
  ## 0.6.91
10
35
 
11
36
  - **Fixed** `contiguityOf` answering `'unknown'` for an argument that is not a record index at all.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.91",
3
+ "version": "0.6.93",
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.91';
96
+ export const VERSION = '0.6.93';
@@ -114,9 +114,18 @@ export function getSignal(header: EdfHeader, selector: number | string): EdfSign
114
114
  if (typeof selector === 'number') {
115
115
  const signal = header.signals[selector];
116
116
  if (signal !== undefined) return signal;
117
+ /*
118
+ * A fractional index is not "outside" anything. `getSignal(header, 1.5)` — which is what a
119
+ * midpoint, an average or a division by a sample rate produces — was told it "is outside the 7
120
+ * signals this file declares. Next: pass an index in 0..6", and 1.5 already is one: the message
121
+ * named a rule the rejected value satisfies (fixed in 0.6.93).
122
+ */
117
123
  throw new EdfChannelNotFoundError(
118
- `signal index ${selector} is outside the ${header.signals.length} signals this file ` +
119
- `declares. Labels, in signal order: ${quoteLabels(header)}. Next: pass an index in ` +
124
+ `signal index ${selector} ${
125
+ Number.isInteger(selector)
126
+ ? `is outside the ${header.signals.length} signals this file declares`
127
+ : 'is not a whole number, so it falls between two signals rather than outside them'
128
+ }. Labels, in signal order: ${quoteLabels(header)}. Next: pass a whole index in ` +
120
129
  `0..${header.signals.length - 1}, or a label.`,
121
130
  { selector, availableLabels: header.signals.map((signal) => signal.label) },
122
131
  );
package/src/tal/ticks.ts CHANGED
@@ -225,7 +225,32 @@ export function saturateToInt64(ticks: bigint): bigint {
225
225
  * prefix, "because a hard-coded name would be wrong for all but one of them" — which is the choice
226
226
  * available when the callers cannot say. These can.
227
227
  */
228
+ /**
229
+ * A value that is not a number at all, said in a way that does not read as a valid one.
230
+ *
231
+ * The template below interpolated it bare, so the message named a rule the printed value satisfies.
232
+ * A BigInt is the sharp case: this package hands out `onsetTicksFromFirstRecord` and every other
233
+ * instant as ticks, and passing one where seconds belong earned "startSeconds must be a finite
234
+ * number of seconds, but was 10000000" — which is a finite number of seconds (fixed in 0.6.92).
235
+ */
236
+ function describeSeconds(seconds: unknown): string {
237
+ if (typeof seconds === 'bigint') return `the BigInt ${seconds}n`;
238
+ if (typeof seconds === 'string') return `the string ${JSON.stringify(seconds)}`;
239
+ if (seconds === null) return 'null';
240
+ return typeof seconds === 'object' ? 'an object' : `a ${typeof seconds}`;
241
+ }
242
+
228
243
  export function secondsToTicks(seconds: number, name: string): bigint {
244
+ // Separated from the finiteness check below so that neither message can describe the other's
245
+ // value: "not finite" is about a number, and `NaN`, `Infinity` and `undefined` all read correctly
246
+ // as themselves. A string or a BigInt does not.
247
+ if (typeof seconds !== 'number' && seconds !== undefined) {
248
+ throw new RangeError(
249
+ `${name} must be a number of seconds, and was given ${describeSeconds(seconds)}. Next: ` +
250
+ 'convert it first — Number(text) for a string, and for a tick count the matching ' +
251
+ '*Seconds field beside it, which every instant edfcore hands out carries.',
252
+ );
253
+ }
229
254
  if (!Number.isFinite(seconds)) {
230
255
  throw new RangeError(
231
256
  `${name} must be a finite number of seconds, but was ${seconds}. Next: check the ` +