Browse Source

Merge pull request #460 from jprichardson/docs

Document writeJson() & outputJson() options
ci/travis-osximage
JP Richardson 7 years ago
committed by GitHub
parent
commit
ea2e2a42ad
  1. 4
      docs/outputJson-sync.md
  2. 4
      docs/outputJson.md
  3. 6
      docs/writeJson-sync.md
  4. 6
      docs/writeJson.md

4
docs/outputJson-sync.md

@ -1,13 +1,15 @@
# outputJsonSync(file, object, [options])
Almost the same as [`writeJsonSync`](writeJson-sync.md), except that if the directory does not exist, it's created.
`options` are what you'd pass to [`jsonFile.writeFileSync()`](https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options).
**Alias:** `outputJSONSync()`
- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
- Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
## Example:

4
docs/outputJson.md

@ -1,13 +1,15 @@
# outputJson(file, object, [options, callback])
Almost the same as [`writeJson`](writeJson.md), except that if the directory does not exist, it's created.
`options` are what you'd pass to [`jsonFile.writeFile()`](https://github.com/jprichardson/node-jsonfile#writefilefilename-options-callback).
**Alias:** `outputJSON()`
- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
- Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
- `callback` `<Function>`
## Example:

6
docs/writeJson-sync.md

@ -1,13 +1,15 @@
# writeJsonSync(file, object, [options])
Writes an object to a JSON file. `options` are the same that
you'd pass to [`jsonFile.writeFileSync()`](https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options).
Writes an object to a JSON file.
**Alias:** `writeJSONSync()`
- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
- Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options)
## Example:

6
docs/writeJson.md

@ -1,13 +1,15 @@
# writeJson(file, object, [options, callback])
Writes an object to a JSON file. `options` are the same that
you'd pass to [`jsonFile.writeFile()`](https://github.com/jprichardson/node-jsonfile#writefilefilename-options-callback).
Writes an object to a JSON file.
**Alias:** `writeJSON()`
- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`
- `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info.
- `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter)
- Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback)
- `callback` `<Function>`
## Example:

Loading…
Cancel
Save