@thi.ng/markdown-table 0.3.122 → 0.3.124

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
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-05-08T18:24:32Z
3
+ - **Last updated**: 2024-06-29T09:28:36Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [0.3.123](https://github.com/thi-ng/umbrella/tree/@thi.ng/markdown-table@0.3.123) (2024-06-21)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
17
+
12
18
  ### [0.3.78](https://github.com/thi-ng/umbrella/tree/@thi.ng/markdown-table@0.3.78) (2023-11-09)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 189 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
@@ -66,7 +66,7 @@ For Node.js REPL:
66
66
  const mt = await import("@thi.ng/markdown-table");
67
67
  ```
68
68
 
69
- Package sizes (brotli'd, pre-treeshake): ESM: 613 bytes
69
+ Package sizes (brotli'd, pre-treeshake): ESM: 617 bytes
70
70
 
71
71
  ## Dependencies
72
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/markdown-table",
3
- "version": "0.3.122",
3
+ "version": "0.3.124",
4
4
  "description": "Markdown table formatter/generator with support for column alignments",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
12
12
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/markdown-table#readme",
13
+ "homepage": "https://thi.ng/markdown-table",
14
14
  "funding": [
15
15
  {
16
16
  "type": "github",
@@ -36,18 +36,18 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.2",
40
- "@thi.ng/checks": "^3.6.4",
41
- "@thi.ng/compose": "^3.0.4",
42
- "@thi.ng/errors": "^2.5.7",
43
- "@thi.ng/strings": "^3.7.33",
44
- "@thi.ng/transducers": "^9.0.5"
39
+ "@thi.ng/api": "^8.11.4",
40
+ "@thi.ng/checks": "^3.6.6",
41
+ "@thi.ng/compose": "^3.0.6",
42
+ "@thi.ng/errors": "^2.5.9",
43
+ "@thi.ng/strings": "^3.7.35",
44
+ "@thi.ng/transducers": "^9.0.7"
45
45
  },
46
46
  "devDependencies": {
47
- "@microsoft/api-extractor": "^7.43.2",
48
- "esbuild": "^0.21.1",
47
+ "@microsoft/api-extractor": "^7.47.0",
48
+ "esbuild": "^0.21.5",
49
49
  "typedoc": "^0.25.13",
50
- "typescript": "^5.4.5"
50
+ "typescript": "^5.5.2"
51
51
  },
52
52
  "keywords": [
53
53
  "align",
@@ -87,5 +87,5 @@
87
87
  ],
88
88
  "year": 2021
89
89
  },
90
- "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
90
+ "gitHead": "7b950c112fba0b2e7c450765b15624c3382f1354\n"
91
91
  }
package/table.d.ts CHANGED
@@ -9,10 +9,10 @@ import type { Column, Row, TableOpts } from "./api.js";
9
9
  * can also be empty. By default all columns are left-aligned.
10
10
  *
11
11
  * @example
12
- * ```ts
12
+ * ```ts tangle:../export/table.ts
13
13
  * import { table } from "@thi.ng/markdown-table";
14
14
  *
15
- * table(
15
+ * const res = table(
16
16
  * ["ID", "Actor", "Comment"],
17
17
  * [
18
18
  * [1, "Alice"],
@@ -23,6 +23,7 @@ import type { Column, Row, TableOpts } from "./api.js";
23
23
  * { bold: true, align: ["r", "c", "l"] }
24
24
  * );
25
25
  *
26
+ * console.log(res);
26
27
  * // | **ID** | **Actor** | **Comment** |
27
28
  * // |-------:|:---------:|:------------|
28
29
  * // | 1 | Alice | |
@@ -41,10 +42,10 @@ export declare const table: (header: string[], rows: Iterable<Row>, opts?: Parti
41
42
  * values using given `keys` array.
42
43
  *
43
44
  * @example
44
- * ```ts
45
+ * ```ts tangle:../export/table-keys.ts
45
46
  * import { tableKeys } from "@thi.ng/markdown-table";
46
47
  *
47
- * tableKeys(
48
+ * const res = tableKeys(
48
49
  * ["ID", "Actor", "Comment"],
49
50
  * ["id", "name", (x) => x.hint],
50
51
  * [
@@ -54,8 +55,9 @@ export declare const table: (header: string[], rows: Iterable<Row>, opts?: Parti
54
55
  * { id: 44, name: "Dora", hint: "(recipient)" },
55
56
  * ],
56
57
  * { bold: true, align: ["r", "c", "l"] }
57
- * )
58
+ * );
58
59
  *
60
+ * console.log(res);
59
61
  * // | **ID** | **Actor** | **Comment** |
60
62
  * // |-------:|:---------:|:------------|
61
63
  * // | 1 | Alice | |
package/table.js CHANGED
@@ -52,7 +52,7 @@ const table = (header, rows, opts = {}) => {
52
52
  const pads = widths.map((w, i) => PADS[align[i]](w));
53
53
  const colIDs = [...range(numColumns)];
54
54
  const result = body.map(
55
- (row) => colIDs.map((i) => `| ${pads[i](str(row[i]))} `).join("") + "|"
55
+ (row) => colIDs.map((i) => `| ${pads[i](__str(row[i]))} `).join("") + "|"
56
56
  );
57
57
  result.splice(
58
58
  1,
@@ -65,13 +65,13 @@ const tableKeys = (headers, keys, items, opts) => table(
65
65
  headers,
66
66
  map(
67
67
  juxt(
68
- ...keys.map((k) => isString(k) ? (x) => str(x[k]) : k)
68
+ ...keys.map((k) => isString(k) ? (x) => __str(x[k]) : k)
69
69
  ),
70
70
  items
71
71
  ),
72
72
  opts
73
73
  );
74
- const str = (x) => x != null ? String(x) : "";
74
+ const __str = (x) => x != null ? String(x) : "";
75
75
  export {
76
76
  table,
77
77
  tableKeys