edf2csv 0.7.57 → 0.7.58

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.
@@ -21,6 +21,7 @@
21
21
  * it says the list was cut without pretending the tail does not exist.
22
22
  *
23
23
  * listed(['1 Hz', '2 Hz']) -> '1 Hz, 2 Hz'
24
+ * listed(rates9) -> all nine; see below
24
25
  * listed(rates200) -> '200 Hz, 199 Hz, ... 193 Hz and 192 more'
25
26
  */
26
27
  export declare function listed(items: readonly string[], limit?: number): string;
@@ -23,10 +23,27 @@ const DEFAULT_LIMIT = 8;
23
23
  * it says the list was cut without pretending the tail does not exist.
24
24
  *
25
25
  * listed(['1 Hz', '2 Hz']) -> '1 Hz, 2 Hz'
26
+ * listed(rates9) -> all nine; see below
26
27
  * listed(rates200) -> '200 Hz, 199 Hz, ... 193 Hz and 192 more'
27
28
  */
28
29
  export function listed(items, limit = DEFAULT_LIMIT) {
29
- if (items.length <= limit)
30
+ /*
31
+ One item over the limit is shown rather than counted.
32
+
33
+ "and 1 more" is eleven characters standing in for a single item, and an item is rarely
34
+ that long. Nine sampling rates came out as
35
+
36
+ Channels use 9 different sampling rates (100 Hz, 99 Hz, 98 Hz, 97 Hz, 96 Hz,
37
+ 95 Hz, 94 Hz, 93 Hz and 1 more).
38
+
39
+ which is four characters longer than naming all nine and one rate shorter — while the
40
+ sentence around it has already said there are nine, so the reader is told the count and
41
+ then denied the item. A cut that costs more than it hides is not a cut.
42
+
43
+ Two is where it starts paying: ", 92 Hz, 91 Hz" against " and 2 more". Beyond that it is
44
+ the whole point.
45
+ */
46
+ if (items.length <= limit + 1)
30
47
  return items.join(', ');
31
48
  const shown = items.slice(0, limit).join(', ');
32
49
  return `${shown} and ${items.length - limit} more`;
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/format/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,kEAAkE;AAClE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAC,KAAwB,EAAE,KAAK,GAAG,aAAa;IACpE,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,GAAG,KAAK,QAAQ,KAAK,CAAC,MAAM,GAAG,KAAK,OAAO,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,QAAgB,EAAE,MAAM,GAAG,GAAG,QAAQ,GAAG;IAC1E,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n * Rendering a set of things inside a sentence, without letting the file decide how long\n * the sentence gets.\n *\n * Several messages enumerate something the recording controls: its sampling rates, its\n * channel positions. On an ordinary file that is a handful of items and listing them all is\n * exactly right — the rates are what `--channels` has to choose between, so naming them is\n * the whole use of the message. On a file with two hundred channels the same code produced a\n * single 1,600-character line:\n *\n * warning: Channels use 200 different sampling rates (200 Hz, 199 Hz, 198 Hz, ... 1 Hz).\n *\n * which wraps across a whole terminal and buries the sentence that mattered. Nothing was\n * wrong with the conversion; the message was simply unreadable at a size the header is free\n * to ask for.\n */\n\n/** How many items a message shows before summarising the rest. */\nconst DEFAULT_LIMIT = 8;\n\n/**\n * Join items for a sentence, keeping at most `limit` of them.\n *\n * Beyond the limit the remainder is counted rather than named. The count is the honest part:\n * it says the list was cut without pretending the tail does not exist.\n *\n * listed(['1 Hz', '2 Hz']) -> '1 Hz, 2 Hz'\n * listed(rates200) -> '200 Hz, 199 Hz, ... 193 Hz and 192 more'\n */\nexport function listed(items: readonly string[], limit = DEFAULT_LIMIT): string {\n if (items.length <= limit) return items.join(', ');\n const shown = items.slice(0, limit).join(', ');\n return `${shown} and ${items.length - limit} more`;\n}\n\n/**\n * A count and its noun, agreeing.\n *\n * Every one of these was written `${n} records`, which is right until the file has one of\n * them — and a one-record recording, a one-byte tail and a batch of one are all ordinary.\n * `--info` opened with \"Duration 1s (1 records of 1s)\" and a truncated file warned that\n * \"1 bytes after the last complete data record were ignored\". Small, and on the two lines a\n * reader looks at first.\n *\n * The plural is `<singular>s` unless given, since English mostly cooperates here and the\n * exceptions in this codebase — \"entries\" — are spelled out at the call site.\n *\n * counted(1, 'record') -> '1 record'\n * counted(4, 'record') -> '4 records'\n * counted(1, 'entry', 'entries') -> '1 entry'\n */\nexport function counted(n: number, singular: string, plural = `${singular}s`): string {\n return `${n} ${n === 1 ? singular : plural}`;\n}\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/format/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,kEAAkE;AAClE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAAC,KAAwB,EAAE,KAAK,GAAG,aAAa;IACpE;;;;;;;;;;;;;;;MAeE;IACF,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,GAAG,KAAK,QAAQ,KAAK,CAAC,MAAM,GAAG,KAAK,OAAO,CAAC;AACrD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,QAAgB,EAAE,MAAM,GAAG,GAAG,QAAQ,GAAG;IAC1E,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["/**\n * Rendering a set of things inside a sentence, without letting the file decide how long\n * the sentence gets.\n *\n * Several messages enumerate something the recording controls: its sampling rates, its\n * channel positions. On an ordinary file that is a handful of items and listing them all is\n * exactly right — the rates are what `--channels` has to choose between, so naming them is\n * the whole use of the message. On a file with two hundred channels the same code produced a\n * single 1,600-character line:\n *\n * warning: Channels use 200 different sampling rates (200 Hz, 199 Hz, 198 Hz, ... 1 Hz).\n *\n * which wraps across a whole terminal and buries the sentence that mattered. Nothing was\n * wrong with the conversion; the message was simply unreadable at a size the header is free\n * to ask for.\n */\n\n/** How many items a message shows before summarising the rest. */\nconst DEFAULT_LIMIT = 8;\n\n/**\n * Join items for a sentence, keeping at most `limit` of them.\n *\n * Beyond the limit the remainder is counted rather than named. The count is the honest part:\n * it says the list was cut without pretending the tail does not exist.\n *\n * listed(['1 Hz', '2 Hz']) -> '1 Hz, 2 Hz'\n * listed(rates9) -> all nine; see below\n * listed(rates200) -> '200 Hz, 199 Hz, ... 193 Hz and 192 more'\n */\nexport function listed(items: readonly string[], limit = DEFAULT_LIMIT): string {\n /*\n One item over the limit is shown rather than counted.\n\n \"and 1 more\" is eleven characters standing in for a single item, and an item is rarely\n that long. Nine sampling rates came out as\n\n Channels use 9 different sampling rates (100 Hz, 99 Hz, 98 Hz, 97 Hz, 96 Hz,\n 95 Hz, 94 Hz, 93 Hz and 1 more).\n\n which is four characters longer than naming all nine and one rate shorter — while the\n sentence around it has already said there are nine, so the reader is told the count and\n then denied the item. A cut that costs more than it hides is not a cut.\n\n Two is where it starts paying: \", 92 Hz, 91 Hz\" against \" and 2 more\". Beyond that it is\n the whole point.\n */\n if (items.length <= limit + 1) return items.join(', ');\n const shown = items.slice(0, limit).join(', ');\n return `${shown} and ${items.length - limit} more`;\n}\n\n/**\n * A count and its noun, agreeing.\n *\n * Every one of these was written `${n} records`, which is right until the file has one of\n * them — and a one-record recording, a one-byte tail and a batch of one are all ordinary.\n * `--info` opened with \"Duration 1s (1 records of 1s)\" and a truncated file warned that\n * \"1 bytes after the last complete data record were ignored\". Small, and on the two lines a\n * reader looks at first.\n *\n * The plural is `<singular>s` unless given, since English mostly cooperates here and the\n * exceptions in this codebase — \"entries\" — are spelled out at the call site.\n *\n * counted(1, 'record') -> '1 record'\n * counted(4, 'record') -> '4 records'\n * counted(1, 'entry', 'entries') -> '1 entry'\n */\nexport function counted(n: number, singular: string, plural = `${singular}s`): string {\n return `${n} ${n === 1 ? singular : plural}`;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edf2csv",
3
- "version": "0.7.57",
3
+ "version": "0.7.58",
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",