Skip to content

Commit 12da92d

Browse files
jsejcksncaspervonb
authored andcommitted
fix(encoding/csv): Correct readme formatting due to dprint issues (denoland/deno#8503)
1 parent 20cc4d3 commit 12da92d

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

encoding/README.md

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,32 @@ function is as follows:
102102
103103
`DataItem: Record<string, unknown> | unknown[]`
104104
105-
```ts
106-
const data = [
107-
{
108-
name: "Deno",
109-
repo: { org: "denoland", name: "deno" },
110-
runsOn: ["Rust", "TypeScript"],
111-
},
112-
];
113-
```
105+
```ts
106+
const data = [
107+
{
108+
name: "Deno",
109+
repo: { org: "denoland", name: "deno" },
110+
runsOn: ["Rust", "TypeScript"],
111+
},
112+
];
113+
```
114114
115115
- **`columns`** is a list of instructions for how to target and transform the
116116
data for each column of output. This is also where you can provide an explicit
117117
header name for the column.
118118
119119
`Column`:
120+
120121
- The most essential aspect of a column is accessing the property holding the
121122
data for that column on each object in the data array. If that member is at
122123
the top level, `Column` can simply be a property accessor, which is either a
123124
`string` (if it's a plain object) or a `number` (if it's an array).
124125
125-
```ts
126-
const columns = [
127-
"name",
128-
];
129-
```
126+
```ts
127+
const columns = [
128+
"name",
129+
];
130+
```
130131
131132
Each property accessor will be used as the header for the column:
132133
@@ -138,12 +139,12 @@ function is as follows:
138139
objects/arrays), then a simple property accessor won't work, so an array of
139140
them will be required.
140141
141-
```ts
142-
const columns = [
143-
["repo", "name"],
144-
["repo", "org"],
145-
];
146-
```
142+
```ts
143+
const columns = [
144+
["repo", "name"],
145+
["repo", "org"],
146+
];
147+
```
147148
148149
When using arrays of property accessors, the header names inherit the value
149150
of the last accessor in each array:
@@ -158,27 +159,29 @@ function is as follows:
158159
159160
- **`fn?: (value: any) => string | Promise<string>`** is an optional
160161
function to transform the targeted data into the desired format
162+
161163
- **`header?: string`** is the optional value to use for the column header
162164
name
165+
163166
- **`prop: PropertyAccessor | PropertyAccessor[]`** is the property accessor
164167
(`string` or `number`) or array of property accessors used to access the
165168
data on each object
166169
167-
```ts
168-
const columns = [
169-
"name",
170-
{
171-
prop: ["runsOn", 0],
172-
header: "language 1",
173-
fn: (str: string) => str.toLowerCase(),
174-
},
175-
{
176-
prop: ["runsOn", 1],
177-
header: "language 2",
178-
fn: (str: string) => str.toLowerCase(),
179-
},
180-
];
181-
```
170+
```ts
171+
const columns = [
172+
"name",
173+
{
174+
prop: ["runsOn", 0],
175+
header: "language 1",
176+
fn: (str: string) => str.toLowerCase(),
177+
},
178+
{
179+
prop: ["runsOn", 1],
180+
header: "language 2",
181+
fn: (str: string) => str.toLowerCase(),
182+
},
183+
];
184+
```
182185

183186
| name | language 1 | language 2 |
184187
| :--: | :--------: | :--------: |

0 commit comments

Comments
 (0)