Skip to content

Commit f42f02e

Browse files
author
Adrien Blanc
committed
updated writeJSON README
1 parent 92b789a commit f42f02e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,26 @@ const json = await readJSON('www.url.com/file.json')
177177
#### writeJSON
178178

179179
```ts
180-
writeJSON(path: string, data: any): void
180+
writeJSON(path: string, data: any, replacer?: any, space?: string | number): void
181+
182+
181183
```
182184

183185
Args:
184186

185187
* **path**: path to a local JSON file
186188
* **data**: data to store as JSON
189+
* **replacer**: [replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#parameters) function that transforms the results or an array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified
190+
* **space**: adds indentation, white space, and line break characters to the to the JSON text to make it easier to read.
191+
187192

188193
Usage:
189194

190195
```ts
191196
const data = { age: 40 }
192197
await writeJSON('./path/to/file.json', data)
198+
199+
await writeJSON('./path/to/file-with-indentation', data, null, 2)
193200
```
194201

195202
### XLSX

0 commit comments

Comments
 (0)