edf2csv 0.8.40 → 0.8.41

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.
@@ -46,7 +46,24 @@ export function listed(items, limit = DEFAULT_LIMIT) {
46
46
  if (items.length <= limit + 1)
47
47
  return items.join(', ');
48
48
  const shown = items.slice(0, limit).join(', ');
49
- return `${shown} and ${items.length - limit} more`;
49
+ /*
50
+ Grouped, like every other count this tool prints.
51
+
52
+ This one is written in the same sentences as the grouped ones and was the only bare
53
+ number among them. A discontinuous recording whose timekeeping is unreadable throughout
54
+ put all three side by side:
55
+
56
+ 1,010 of 1,010 data records carry no readable timekeeping annotation
57
+ (records 0, 1, 2, 3, 4, 5, 6, 7 and 1002 more), so their true position in
58
+ time is unknown.
59
+
60
+ Two counts of the same set of records, a comma apart, spelled two ways — and the reader
61
+ is meant to subtract one from the other to see how many were named. `grouped`'s own
62
+ comment is about exactly that: "two figures sit in one sentence to be compared against
63
+ each other". The tail count escaped it because it is built here rather than at a call
64
+ site, and `counted` was the only door into `grouped`.
65
+ */
66
+ return `${shown} and ${grouped(items.length - limit)} more`;
50
67
  }
51
68
  /**
52
69
  * A count and its noun, agreeing.
@@ -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;;;;;;;;;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,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACnC,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 `${grouped(n)} ${n === 1 ? singular : plural}`;\n}\n\n/**\n * A count, in the digit grouping the rest of this tool's counts are printed in.\n *\n * `--info` printed two counts of the same recording ten lines apart:\n *\n * Duration 8h 00m 0s (28800 records of 1s)\n * Would write 3,196,800 rows, roughly 108 MB.\n *\n * and the warning under them, \"more than 1,048,576 rows, which is more than Excel or Numbers\n * can open\", made three. Row counts were grouped because they were written that way; every\n * count that went through `counted` was not, because it was written the other way. Nothing\n * decided that — the two were never compared.\n *\n * Which matters most where two figures sit in one sentence to be compared against each\n * other: \"The file contains 39321 bytes of data, which is less than the 65536 its header\n * says one data record takes\" is a subtraction the reader is being asked to do by eye.\n *\n * Named so the neighbours of a `counted` call can be printed the same way without a third\n * copy of the locale string, and so there is one place to change if that is ever wrong.\n */\nexport function grouped(n: number): string {\n return n.toLocaleString('en-US');\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;;;;;;;;;;;;;;;;MAgBE;IACF,OAAO,GAAG,KAAK,QAAQ,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,QAAgB,EAAE,MAAM,GAAG,GAAG,QAAQ,GAAG;IAC1E,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACnC,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 /*\n Grouped, like every other count this tool prints.\n\n This one is written in the same sentences as the grouped ones and was the only bare\n number among them. A discontinuous recording whose timekeeping is unreadable throughout\n put all three side by side:\n\n 1,010 of 1,010 data records carry no readable timekeeping annotation\n (records 0, 1, 2, 3, 4, 5, 6, 7 and 1002 more), so their true position in\n time is unknown.\n\n Two counts of the same set of records, a comma apart, spelled two ways — and the reader\n is meant to subtract one from the other to see how many were named. `grouped`'s own\n comment is about exactly that: \"two figures sit in one sentence to be compared against\n each other\". The tail count escaped it because it is built here rather than at a call\n site, and `counted` was the only door into `grouped`.\n */\n return `${shown} and ${grouped(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 `${grouped(n)} ${n === 1 ? singular : plural}`;\n}\n\n/**\n * A count, in the digit grouping the rest of this tool's counts are printed in.\n *\n * `--info` printed two counts of the same recording ten lines apart:\n *\n * Duration 8h 00m 0s (28800 records of 1s)\n * Would write 3,196,800 rows, roughly 108 MB.\n *\n * and the warning under them, \"more than 1,048,576 rows, which is more than Excel or Numbers\n * can open\", made three. Row counts were grouped because they were written that way; every\n * count that went through `counted` was not, because it was written the other way. Nothing\n * decided that — the two were never compared.\n *\n * Which matters most where two figures sit in one sentence to be compared against each\n * other: \"The file contains 39321 bytes of data, which is less than the 65536 its header\n * says one data record takes\" is a subtraction the reader is being asked to do by eye.\n *\n * Named so the neighbours of a `counted` call can be printed the same way without a third\n * copy of the locale string, and so there is one place to change if that is ever wrong.\n */\nexport function grouped(n: number): string {\n return n.toLocaleString('en-US');\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edf2csv",
3
- "version": "0.8.40",
3
+ "version": "0.8.41",
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",