Skip to content

Commit e1ddcb7

Browse files
TimothyGulpinca
authored andcommitted
doc: standardize rest parameters
PR-URL: nodejs#8485 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ad1a9dd commit e1ddcb7

8 files changed

Lines changed: 46 additions & 46 deletions

File tree

doc/api/console.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The global `console` is a special `Console` whose output is sent to
100100
new Console(process.stdout, process.stderr);
101101
```
102102

103-
### console.assert(value[, message][, ...])
103+
### console.assert(value[, message][, ...args])
104104
<!-- YAML
105105
added: v0.1.101
106106
-->
@@ -177,7 +177,7 @@ Defaults to `2`. To make it recurse indefinitely, pass `null`.
177177
Defaults to `false`. Colors are customizable; see
178178
[customizing `util.inspect()` colors][].
179179

180-
### console.error([data][, ...])
180+
### console.error([data][, ...args])
181181
<!-- YAML
182182
added: v0.1.100
183183
-->
@@ -199,14 +199,14 @@ If formatting elements (e.g. `%d`) are not found in the first string then
199199
[`util.inspect()`][] is called on each argument and the resulting string
200200
values are concatenated. See [`util.format()`][] for more information.
201201

202-
### console.info([data][, ...])
202+
### console.info([data][, ...args])
203203
<!-- YAML
204204
added: v0.1.100
205205
-->
206206

207207
The `console.info()` function is an alias for [`console.log()`][].
208208

209-
### console.log([data][, ...])
209+
### console.log([data][, ...args])
210210
<!-- YAML
211211
added: v0.1.100
212212
-->
@@ -260,7 +260,7 @@ leaking it. On older versions, the timer persisted. This allowed
260260
`console.timeEnd()` to be called multiple times for the same label. This
261261
functionality was unintended and is no longer supported.*
262262

263-
### console.trace(message[, ...])
263+
### console.trace(message[, ...args])
264264
<!-- YAML
265265
added: v0.1.104
266266
-->
@@ -284,20 +284,20 @@ console.trace('Show me');
284284
// at REPLServer.Interface._ttyWrite (readline.js:826:14)
285285
```
286286

287-
### console.warn([data][, ...])
287+
### console.warn([data][, ...args])
288288
<!-- YAML
289289
added: v0.1.100
290290
-->
291291

292292
The `console.warn()` function is an alias for [`console.error()`][].
293293

294-
[`console.error()`]: #console_console_error_data
295-
[`console.log()`]: #console_console_log_data
294+
[`console.error()`]: #console_console_error_data_args
295+
[`console.log()`]: #console_console_log_data_args
296296
[`console.time()`]: #console_console_time_label
297297
[`console.timeEnd()`]: #console_console_timeend_label
298298
[`process.stderr`]: process.html#process_process_stderr
299299
[`process.stdout`]: process.html#process_process_stdout
300-
[`util.format()`]: util.html#util_util_format_format
300+
[`util.format()`]: util.html#util_util_format_format_args
301301
[`util.inspect()`]: util.html#util_util_inspect_object_options
302302
[customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors
303303
[web-api-assert]: https://developer.mozilla.org/en-US/docs/Web/API/console/assert

doc/api/domain.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,10 @@ uncaught exceptions to the active Domain object.
269269
Domain is a child class of [`EventEmitter`][]. To handle the errors that it
270270
catches, listen to its `'error'` event.
271271

272-
### domain.run(fn[, arg][, ...])
272+
### domain.run(fn[, ...args])
273273

274274
* `fn` {Function}
275+
* `...args` {any}
275276

276277
Run the supplied function in the context of the domain, implicitly
277278
binding all event emitters, timers, and lowlevel requests that are
@@ -449,6 +450,6 @@ is emitted.
449450
[`domain.exit()`]: #domain_domain_exit
450451
[`Error`]: errors.html#errors_class_error
451452
[`EventEmitter`]: events.html#events_class_eventemitter
452-
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg
453-
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg
453+
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args
454+
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args
454455
[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw

doc/api/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ added: v0.1.26
294294

295295
Alias for `emitter.on(eventName, listener)`.
296296

297-
### emitter.emit(eventName[, arg1][, arg2][, ...])
297+
### emitter.emit(eventName[, ...args])
298298
<!-- YAML
299299
added: v0.1.26
300300
-->

doc/api/globals.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,19 @@ left untouched.
182182
Use the internal `require()` machinery to look up the location of a module,
183183
but rather than loading the module, just return the resolved filename.
184184

185-
## setImmediate(callback[, arg][, ...])
185+
## setImmediate(callback[, ...args])
186186

187187
<!-- type=global -->
188188

189189
[`setImmediate`] is described in the [timers][] section.
190190

191-
## setInterval(callback, delay[, arg][, ...])
191+
## setInterval(callback, delay[, ...args])
192192

193193
<!-- type=global -->
194194

195195
[`setInterval`] is described in the [timers][] section.
196196

197-
## setTimeout(callback, delay[, arg][, ...])
197+
## setTimeout(callback, delay[, ...args])
198198

199199
<!-- type=global -->
200200

@@ -210,7 +210,7 @@ but rather than loading the module, just return the resolved filename.
210210
[`clearImmediate`]: timers.html#timers_clearimmediate_immediate
211211
[`clearInterval`]: timers.html#timers_clearinterval_timeout
212212
[`clearTimeout`]: timers.html#timers_cleartimeout_timeout
213-
[`setImmediate`]: timers.html#timers_setimmediate_callback_arg
214-
[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg
215-
[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg
213+
[`setImmediate`]: timers.html#timers_setimmediate_callback_args
214+
[`setInterval`]: timers.html#timers_setinterval_callback_delay_args
215+
[`setTimeout`]: timers.html#timers_settimeout_callback_delay_args
216216
[built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects

doc/api/path.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ path.isAbsolute('.') // false
272272

273273
A [`TypeError`][] is thrown if `path` is not a string.
274274

275-
## path.join([path[, ...]])
275+
## path.join([...paths])
276276
<!-- YAML
277277
added: v0.1.16
278278
-->
279279

280-
* `[path[, ...]]` {String} A sequence of path segments
280+
* `...paths` {String} A sequence of path segments
281281

282282
The `path.join()` method join all given `path` segments together using the
283283
platform specific separator as a delimiter, then normalizes the resulting path.
@@ -438,12 +438,12 @@ path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb')
438438

439439
A [`TypeError`][] is thrown if neither `from` nor `to` is a string.
440440

441-
## path.resolve([path[, ...]])
441+
## path.resolve([...paths])
442442
<!-- YAML
443443
added: v0.3.4
444444
-->
445445

446-
* `[path[, ...]]` {String} A sequence of paths or path segments
446+
* `...paths` {String} A sequence of paths or path segments
447447

448448
The `path.resolve()` method resolves a sequence of paths or path segments into
449449
an absolute path.

doc/api/process.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,14 +1143,13 @@ Will generate:
11431143

11441144
`heapTotal` and `heapUsed` refer to V8's memory usage.
11451145

1146-
## process.nextTick(callback[, arg][, ...])
1146+
## process.nextTick(callback[, ...args])
11471147
<!-- YAML
11481148
added: v0.1.26
11491149
-->
11501150

11511151
* `callback` {Function}
1152-
* `[, arg][, ...]` {any} Additional arguments to pass when invoking the
1153-
`callback`
1152+
* `...args` {any} Additional arguments to pass when invoking the `callback`
11541153

11551154
The `process.nextTick()` method adds the `callback` to the "next tick queue".
11561155
Once the current turn of the event loop turn runs to completion, all callbacks
@@ -1705,7 +1704,7 @@ cases:
17051704
[`process.execPath`]: #process_process_execpath
17061705
[`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
17071706
[`require.main`]: modules.html#modules_accessing_the_main_module
1708-
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg
1707+
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args
17091708
[process_emit_warning]: #process_process_emitwarning_warning_name_ctor
17101709
[process_warning]: #process_event_warning
17111710
[Signal Events]: #process_signal_events

doc/api/timers.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ a certain period of time. When a timer's function is called varies depending on
6565
which method was used to create the timer and what other work the Node.js
6666
event loop is doing.
6767

68-
### setImmediate(callback[, ...arg])
68+
### setImmediate(callback[, ...args])
6969
<!-- YAML
7070
added: v0.9.1
7171
-->
7272

7373
* `callback` {Function} The function to call at the end of this turn of
7474
[the Node.js Event Loop]
75-
* `[, ...arg]` Optional arguments to pass when the `callback` is called.
75+
* `...args` {any} Optional arguments to pass when the `callback` is called.
7676

7777
Schedules the "immediate" execution of the `callback` after I/O events'
7878
callbacks and before timers created using [`setTimeout()`][] and
@@ -87,15 +87,15 @@ next event loop iteration.
8787

8888
If `callback` is not a function, a [`TypeError`][] will be thrown.
8989

90-
### setInterval(callback, delay[, ...arg])
90+
### setInterval(callback, delay[, ...args])
9191
<!-- YAML
9292
added: v0.0.1
9393
-->
9494

9595
* `callback` {Function} The function to call when the timer elapses.
9696
* `delay` {number} The number of milliseconds to wait before calling the
9797
`callback`.
98-
* `[, ...arg]` Optional arguments to pass when the `callback` is called.
98+
* `...args` {any} Optional arguments to pass when the `callback` is called.
9999

100100
Schedules repeated execution of `callback` every `delay` milliseconds.
101101
Returns a `Timeout` for use with [`clearInterval()`][].
@@ -105,15 +105,15 @@ set to `1`.
105105

106106
If `callback` is not a function, a [`TypeError`][] will be thrown.
107107

108-
### setTimeout(callback, delay[, ...arg])
108+
### setTimeout(callback, delay[, ...args])
109109
<!-- YAML
110110
added: v0.0.1
111111
-->
112112

113113
* `callback` {Function} The function to call when the timer elapses.
114114
* `delay` {number} The number of milliseconds to wait before calling the
115115
`callback`.
116-
* `[, ...arg]` Optional arguments to pass when the `callback` is called.
116+
* `...args` {any} Optional arguments to pass when the `callback` is called.
117117

118118
Schedules execution of a one-time `callback` after `delay` milliseconds.
119119
Returns a `Timeout` for use with [`clearTimeout()`][].
@@ -168,6 +168,6 @@ Cancels a `Timeout` object created by [`setTimeout()`][].
168168
[`clearImmediate()`]: timers.html#timers_clearimmediate_immediate
169169
[`clearInterval()`]: timers.html#timers_clearinterval_timeout
170170
[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout
171-
[`setImmediate()`]: timers.html#timers_setimmediate_callback_arg
172-
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg
173-
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg
171+
[`setImmediate()`]: timers.html#timers_setimmediate_callback_args
172+
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args
173+
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args

doc/api/util.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ The `--throw-deprecation` command line flag and `process.throwDeprecation`
8888
property take precedence over `--trace-deprecation` and
8989
`process.traceDeprecation`.
9090

91-
## util.format(format[, ...])
91+
## util.format(format[, ...args])
9292
<!-- YAML
9393
added: v0.5.3
9494
-->
9595

96-
* `format` {string} A `printf`-like format string.
96+
* `format` {String} A `printf`-like format string.
9797

9898
The `util.format()` method returns a formatted string using the first argument
9999
as a `printf`-like format.
@@ -367,19 +367,19 @@ deprecated: v0.11.3
367367

368368
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
369369
370-
* `string` {string} The message to print to `stderr`
370+
* `string` {String} The message to print to `stderr`
371371

372372
Deprecated predecessor of `console.error`.
373373

374-
### util.error([...])
374+
### util.error([...strings])
375375
<!-- YAML
376376
added: v0.3.0
377377
deprecated: v0.11.3
378378
-->
379379

380380
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
381381
382-
* `string` {string} The message to print to `stderr`
382+
* `...strings` {String} The message to print to `stderr`
383383

384384
Deprecated predecessor of `console.error`.
385385

@@ -781,7 +781,7 @@ deprecated: v6.0.0
781781

782782
> Stability: 0 - Deprecated: Use a third party module instead.
783783
784-
* `string` {string}
784+
* `string` {String}
785785

786786
The `util.log()` method prints the given `string` to `stdout` with an included
787787
timestamp.
@@ -792,7 +792,7 @@ const util = require('util');
792792
util.log('Timestamped message.');
793793
```
794794

795-
### util.print([...])
795+
### util.print([...strings])
796796
<!-- YAML
797797
added: v0.3.0
798798
deprecated: v0.11.3
@@ -802,7 +802,7 @@ deprecated: v0.11.3
802802
803803
Deprecated predecessor of `console.log`.
804804

805-
### util.puts([...])
805+
### util.puts([...strings])
806806
<!-- YAML
807807
added: v0.3.0
808808
deprecated: v0.11.3
@@ -833,7 +833,7 @@ similar built-in functionality through [`Object.assign()`].
833833
[Customizing `util.inspect` colors]: #util_customizing_util_inspect_colors
834834
[Custom inspection functions on Objects]: #util_custom_inspection_functions_on_objects
835835
[`Error`]: errors.html#errors_class_error
836-
[`console.log()`]: console.html#console_console_log_data
837-
[`console.error()`]: console.html#console_console_error_data
836+
[`console.log()`]: console.html#console_console_log_data_args
837+
[`console.error()`]: console.html#console_console_error_data_args
838838
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
839839
[`Object.assign()`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

0 commit comments

Comments
 (0)