edf2csv 0.5.32 → 0.5.33
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
Notable changes to edf2csv. Versions follow [semantic versioning](https://semver.org); while the
|
|
4
4
|
major version is 0, a minor bump may contain breaking changes.
|
|
5
5
|
|
|
6
|
+
## 0.5.33
|
|
7
|
+
|
|
8
|
+
### Fixed: the library accepted a `layout` the command line rejects
|
|
9
|
+
|
|
10
|
+
`edf2csv rec.edf --layout tall` has always been a usage error. `convert(path, { layout:
|
|
11
|
+
'tall' })` took it, wrote the wide layout, and handed back a plan whose `layout` read
|
|
12
|
+
`'tall'` — so a programmatic caller with a typo got a conversion that was not the one they
|
|
13
|
+
asked for, described by a plan that agreed with the typo rather than with the files.
|
|
14
|
+
|
|
15
|
+
`assertOptions` checks every other option that has a shape, and rejects each before a
|
|
16
|
+
directory is created. `layout` arrived in 0.5.0 and never joined them. It has now, with the
|
|
17
|
+
same wording the CLI uses.
|
|
18
|
+
|
|
6
19
|
## 0.5.32
|
|
7
20
|
|
|
8
21
|
### Fixed: `--info` was refused over output it does not write
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/convert/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,yFAAyF;AACzF,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B;AAKD,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/convert/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,yFAAyF;AACzF,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B;AAKD,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,GAAG,IAAI,CAkCP"}
|
package/dist/convert/options.js
CHANGED
|
@@ -41,6 +41,19 @@ export function assertOptions(options) {
|
|
|
41
41
|
throw new OptionError(`${name} must be a number of seconds, got ${describe(value)}.`);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
/*
|
|
45
|
+
Two words, and a caller who writes a third means something the tool cannot do.
|
|
46
|
+
|
|
47
|
+
The command line has always rejected `--layout tall`. The library took it, put it in
|
|
48
|
+
`plan.layout` for the caller to read back, and wrote the wide layout — so a programmatic
|
|
49
|
+
caller with a typo got a conversion that was not the one they asked for, described by a
|
|
50
|
+
plan that agreed with the typo. Every other option that has a shape is checked here; this
|
|
51
|
+
one was added in 0.5.0 and never joined them.
|
|
52
|
+
*/
|
|
53
|
+
const { layout } = options;
|
|
54
|
+
if (layout !== undefined && layout !== 'wide' && layout !== 'long') {
|
|
55
|
+
throw new OptionError(`layout must be "wide" or "long", got ${describe(layout)}.`);
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
/** `NaN` and `-1` read better unquoted; anything else is quoted so its type is visible. */
|
|
46
59
|
function describe(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/convert/options.ts"],"names":[],"mappings":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AC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACtE,MAAM,IAAI,WAAW,CAAC,GAAG,IAAI,qCAAqC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;IAED;;;;;;;;MAQE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACnE,MAAM,IAAI,WAAW,CAAC,wCAAwC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACrF,CAAC;AACH,CAAC;AAED,2FAA2F;AAC3F,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["/**\n * Checking the options a caller passed, before anything is written.\n *\n * The command line has always validated these — `--decimals 1.5` is a usage error and always\n * has been — and the library did not, so the same value behaved differently depending on how\n * it arrived. `convert(file, { decimals: NaN })` resolved successfully having written whole\n * numbers into a column the caller had asked for decimals in, which is the worst of the\n * three: no error, no warning, and output that looks like a deliberate choice. `decimals: -1`\n * reached `toFixed` and came back as a bare RangeError from deep inside the formatter, naming\n * nothing the caller had written. `start: NaN` created the output directory, wrote\n * signals.csv, and then failed with a message about the input being unreadable — a partial\n * conversion, blamed on the file.\n *\n * These run at the top of `buildPlan`, which every path goes through before a directory is\n * created or a stream is opened, so a rejected option leaves nothing behind.\n */\n\n/** A problem with the options a caller passed, as opposed to a problem with the file. */\nexport class OptionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'OptionError';\n }\n}\n\n/** The largest `toFixed` will accept, and what `--decimals` has always documented. */\nconst MAX_DECIMALS = 20;\n\nexport function assertOptions(options: {\n decimals?: number | undefined;\n start?: number | undefined;\n duration?: number | undefined;\n end?: number | undefined;\n layout?: string | undefined;\n}): void {\n const { decimals } = options;\n if (decimals !== undefined) {\n if (!Number.isInteger(decimals) || decimals < 0 || decimals > MAX_DECIMALS) {\n throw new OptionError(\n `decimals must be a whole number between 0 and ${MAX_DECIMALS}, got ${describe(decimals)}.`,\n );\n }\n }\n\n // Seconds from the start of the recording, so a negative one names a moment before the\n // recording began. The command line cannot express these — parseTimeSpec rejects them —\n // and the library could, all the way through to a half-written directory.\n for (const name of ['start', 'duration', 'end'] as const) {\n const value = options[name];\n if (value === undefined) continue;\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {\n throw new OptionError(`${name} must be a number of seconds, got ${describe(value)}.`);\n }\n }\n\n /*\n Two words, and a caller who writes a third means something the tool cannot do.\n\n The command line has always rejected `--layout tall`. The library took it, put it in\n `plan.layout` for the caller to read back, and wrote the wide layout — so a programmatic\n caller with a typo got a conversion that was not the one they asked for, described by a\n plan that agreed with the typo. Every other option that has a shape is checked here; this\n one was added in 0.5.0 and never joined them.\n */\n const { layout } = options;\n if (layout !== undefined && layout !== 'wide' && layout !== 'long') {\n throw new OptionError(`layout must be \"wide\" or \"long\", got ${describe(layout)}.`);\n }\n}\n\n/** `NaN` and `-1` read better unquoted; anything else is quoted so its type is visible. */\nfunction describe(value: unknown): string {\n return typeof value === 'number' ? String(value) : JSON.stringify(value);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edf2csv",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.33",
|
|
4
4
|
"description": "Convert EDF, EDF+ and BDF biosignal recordings (European Data Format) to CSV from the command line. Local, streaming, and never resamples or alters units.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"edf",
|