edf2csv 0.7.209 → 0.7.211

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/cli.js CHANGED
@@ -21,7 +21,7 @@ import { buildPlan, withoutFileRateWarning } from './convert/plan.js';
21
21
  import { ConversionError, USAGE_ERROR_CODES, auditStdout, convert, defaultOutputDir, durationDiagnostics, requestedAnnotationWindow, noAnnotations, noSignalFile, stdoutRefusal, } from './convert/run.js';
22
22
  import { ChannelSelectionError } from './convert/channels.js';
23
23
  // Shared with the library so a bad option is the same error whichever way it arrived.
24
- import { OptionError } from './convert/options.js';
24
+ import { MAX_DECIMALS, OptionError } from './convert/options.js';
25
25
  import { TimeRangeError, parseTimeSpec } from './convert/time-range.js';
26
26
  import { deriveRecordStarts, withTimingPromiseKept } from './convert/timing.js';
27
27
  import { formatDiagnostics, formatInfo, infoJson, formatSummary, printable, printableLines, summaryJson, wrap } from './cli/report.js';
@@ -1938,8 +1938,11 @@ function optionalDecimals(raw) {
1938
1938
  the worst way to be wrong." A precision is the same kind of quiet.
1939
1939
  */
1940
1940
  const value = Number(text);
1941
- if (!/^\d+$/u.test(text) || !Number.isInteger(value) || value < 0 || value > 20) {
1942
- throw new OptionError(`--decimals must be a whole number between 0 and 20, got "${String(raw)}".`);
1941
+ // The ceiling comes from the library's own constant rather than a second copy of 20 here.
1942
+ // Both were 20 and the comment on that constant already claims to be "[t]he largest
1943
+ // `--decimals` accepts" — a claim this function was in a position to falsify.
1944
+ if (!/^\d+$/u.test(text) || !Number.isInteger(value) || value < 0 || value > MAX_DECIMALS) {
1945
+ throw new OptionError(`--decimals must be a whole number between 0 and ${MAX_DECIMALS}, got "${String(raw)}".`);
1943
1946
  }
1944
1947
  return value;
1945
1948
  }