doc: standardize rest parameters
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
ad1a9dd35a
commit
e1ddcb7219
@ -100,7 +100,7 @@ The global `console` is a special `Console` whose output is sent to
|
|||||||
new Console(process.stdout, process.stderr);
|
new Console(process.stdout, process.stderr);
|
||||||
```
|
```
|
||||||
|
|
||||||
### console.assert(value[, message][, ...])
|
### console.assert(value[, message][, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.101
|
added: v0.1.101
|
||||||
-->
|
-->
|
||||||
@ -177,7 +177,7 @@ Defaults to `2`. To make it recurse indefinitely, pass `null`.
|
|||||||
Defaults to `false`. Colors are customizable; see
|
Defaults to `false`. Colors are customizable; see
|
||||||
[customizing `util.inspect()` colors][].
|
[customizing `util.inspect()` colors][].
|
||||||
|
|
||||||
### console.error([data][, ...])
|
### console.error([data][, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
@ -199,14 +199,14 @@ If formatting elements (e.g. `%d`) are not found in the first string then
|
|||||||
[`util.inspect()`][] is called on each argument and the resulting string
|
[`util.inspect()`][] is called on each argument and the resulting string
|
||||||
values are concatenated. See [`util.format()`][] for more information.
|
values are concatenated. See [`util.format()`][] for more information.
|
||||||
|
|
||||||
### console.info([data][, ...])
|
### console.info([data][, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
|
|
||||||
The `console.info()` function is an alias for [`console.log()`][].
|
The `console.info()` function is an alias for [`console.log()`][].
|
||||||
|
|
||||||
### console.log([data][, ...])
|
### console.log([data][, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
@ -260,7 +260,7 @@ leaking it. On older versions, the timer persisted. This allowed
|
|||||||
`console.timeEnd()` to be called multiple times for the same label. This
|
`console.timeEnd()` to be called multiple times for the same label. This
|
||||||
functionality was unintended and is no longer supported.*
|
functionality was unintended and is no longer supported.*
|
||||||
|
|
||||||
### console.trace(message[, ...])
|
### console.trace(message[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.104
|
added: v0.1.104
|
||||||
-->
|
-->
|
||||||
@ -284,20 +284,20 @@ console.trace('Show me');
|
|||||||
// at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
// at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
||||||
```
|
```
|
||||||
|
|
||||||
### console.warn([data][, ...])
|
### console.warn([data][, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.100
|
added: v0.1.100
|
||||||
-->
|
-->
|
||||||
|
|
||||||
The `console.warn()` function is an alias for [`console.error()`][].
|
The `console.warn()` function is an alias for [`console.error()`][].
|
||||||
|
|
||||||
[`console.error()`]: #console_console_error_data
|
[`console.error()`]: #console_console_error_data_args
|
||||||
[`console.log()`]: #console_console_log_data
|
[`console.log()`]: #console_console_log_data_args
|
||||||
[`console.time()`]: #console_console_time_label
|
[`console.time()`]: #console_console_time_label
|
||||||
[`console.timeEnd()`]: #console_console_timeend_label
|
[`console.timeEnd()`]: #console_console_timeend_label
|
||||||
[`process.stderr`]: process.html#process_process_stderr
|
[`process.stderr`]: process.html#process_process_stderr
|
||||||
[`process.stdout`]: process.html#process_process_stdout
|
[`process.stdout`]: process.html#process_process_stdout
|
||||||
[`util.format()`]: util.html#util_util_format_format
|
[`util.format()`]: util.html#util_util_format_format_args
|
||||||
[`util.inspect()`]: util.html#util_util_inspect_object_options
|
[`util.inspect()`]: util.html#util_util_inspect_object_options
|
||||||
[customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors
|
[customizing `util.inspect()` colors]: util.html#util_customizing_util_inspect_colors
|
||||||
[web-api-assert]: https://developer.mozilla.org/en-US/docs/Web/API/console/assert
|
[web-api-assert]: https://developer.mozilla.org/en-US/docs/Web/API/console/assert
|
||||||
|
@ -269,9 +269,10 @@ uncaught exceptions to the active Domain object.
|
|||||||
Domain is a child class of [`EventEmitter`][]. To handle the errors that it
|
Domain is a child class of [`EventEmitter`][]. To handle the errors that it
|
||||||
catches, listen to its `'error'` event.
|
catches, listen to its `'error'` event.
|
||||||
|
|
||||||
### domain.run(fn[, arg][, ...])
|
### domain.run(fn[, ...args])
|
||||||
|
|
||||||
* `fn` {Function}
|
* `fn` {Function}
|
||||||
|
* `...args` {any}
|
||||||
|
|
||||||
Run the supplied function in the context of the domain, implicitly
|
Run the supplied function in the context of the domain, implicitly
|
||||||
binding all event emitters, timers, and lowlevel requests that are
|
binding all event emitters, timers, and lowlevel requests that are
|
||||||
@ -449,6 +450,6 @@ is emitted.
|
|||||||
[`domain.exit()`]: #domain_domain_exit
|
[`domain.exit()`]: #domain_domain_exit
|
||||||
[`Error`]: errors.html#errors_class_error
|
[`Error`]: errors.html#errors_class_error
|
||||||
[`EventEmitter`]: events.html#events_class_eventemitter
|
[`EventEmitter`]: events.html#events_class_eventemitter
|
||||||
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg
|
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args
|
||||||
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg
|
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args
|
||||||
[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw
|
[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw
|
||||||
|
@ -294,7 +294,7 @@ added: v0.1.26
|
|||||||
|
|
||||||
Alias for `emitter.on(eventName, listener)`.
|
Alias for `emitter.on(eventName, listener)`.
|
||||||
|
|
||||||
### emitter.emit(eventName[, arg1][, arg2][, ...])
|
### emitter.emit(eventName[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.26
|
added: v0.1.26
|
||||||
-->
|
-->
|
||||||
|
@ -182,19 +182,19 @@ left untouched.
|
|||||||
Use the internal `require()` machinery to look up the location of a module,
|
Use the internal `require()` machinery to look up the location of a module,
|
||||||
but rather than loading the module, just return the resolved filename.
|
but rather than loading the module, just return the resolved filename.
|
||||||
|
|
||||||
## setImmediate(callback[, arg][, ...])
|
## setImmediate(callback[, ...args])
|
||||||
|
|
||||||
<!-- type=global -->
|
<!-- type=global -->
|
||||||
|
|
||||||
[`setImmediate`] is described in the [timers][] section.
|
[`setImmediate`] is described in the [timers][] section.
|
||||||
|
|
||||||
## setInterval(callback, delay[, arg][, ...])
|
## setInterval(callback, delay[, ...args])
|
||||||
|
|
||||||
<!-- type=global -->
|
<!-- type=global -->
|
||||||
|
|
||||||
[`setInterval`] is described in the [timers][] section.
|
[`setInterval`] is described in the [timers][] section.
|
||||||
|
|
||||||
## setTimeout(callback, delay[, arg][, ...])
|
## setTimeout(callback, delay[, ...args])
|
||||||
|
|
||||||
<!-- type=global -->
|
<!-- type=global -->
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ but rather than loading the module, just return the resolved filename.
|
|||||||
[`clearImmediate`]: timers.html#timers_clearimmediate_immediate
|
[`clearImmediate`]: timers.html#timers_clearimmediate_immediate
|
||||||
[`clearInterval`]: timers.html#timers_clearinterval_timeout
|
[`clearInterval`]: timers.html#timers_clearinterval_timeout
|
||||||
[`clearTimeout`]: timers.html#timers_cleartimeout_timeout
|
[`clearTimeout`]: timers.html#timers_cleartimeout_timeout
|
||||||
[`setImmediate`]: timers.html#timers_setimmediate_callback_arg
|
[`setImmediate`]: timers.html#timers_setimmediate_callback_args
|
||||||
[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg
|
[`setInterval`]: timers.html#timers_setinterval_callback_delay_args
|
||||||
[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg
|
[`setTimeout`]: timers.html#timers_settimeout_callback_delay_args
|
||||||
[built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
|
[built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
|
||||||
|
@ -272,12 +272,12 @@ path.isAbsolute('.') // false
|
|||||||
|
|
||||||
A [`TypeError`][] is thrown if `path` is not a string.
|
A [`TypeError`][] is thrown if `path` is not a string.
|
||||||
|
|
||||||
## path.join([path[, ...]])
|
## path.join([...paths])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.16
|
added: v0.1.16
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* `[path[, ...]]` {String} A sequence of path segments
|
* `...paths` {String} A sequence of path segments
|
||||||
|
|
||||||
The `path.join()` method join all given `path` segments together using the
|
The `path.join()` method join all given `path` segments together using the
|
||||||
platform specific separator as a delimiter, then normalizes the resulting path.
|
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')
|
|||||||
|
|
||||||
A [`TypeError`][] is thrown if neither `from` nor `to` is a string.
|
A [`TypeError`][] is thrown if neither `from` nor `to` is a string.
|
||||||
|
|
||||||
## path.resolve([path[, ...]])
|
## path.resolve([...paths])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.3.4
|
added: v0.3.4
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* `[path[, ...]]` {String} A sequence of paths or path segments
|
* `...paths` {String} A sequence of paths or path segments
|
||||||
|
|
||||||
The `path.resolve()` method resolves a sequence of paths or path segments into
|
The `path.resolve()` method resolves a sequence of paths or path segments into
|
||||||
an absolute path.
|
an absolute path.
|
||||||
|
@ -1143,14 +1143,13 @@ Will generate:
|
|||||||
|
|
||||||
`heapTotal` and `heapUsed` refer to V8's memory usage.
|
`heapTotal` and `heapUsed` refer to V8's memory usage.
|
||||||
|
|
||||||
## process.nextTick(callback[, arg][, ...])
|
## process.nextTick(callback[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.1.26
|
added: v0.1.26
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* `callback` {Function}
|
* `callback` {Function}
|
||||||
* `[, arg][, ...]` {any} Additional arguments to pass when invoking the
|
* `...args` {any} Additional arguments to pass when invoking the `callback`
|
||||||
`callback`
|
|
||||||
|
|
||||||
The `process.nextTick()` method adds the `callback` to the "next tick queue".
|
The `process.nextTick()` method adds the `callback` to the "next tick queue".
|
||||||
Once the current turn of the event loop turn runs to completion, all callbacks
|
Once the current turn of the event loop turn runs to completion, all callbacks
|
||||||
@ -1705,7 +1704,7 @@ cases:
|
|||||||
[`process.execPath`]: #process_process_execpath
|
[`process.execPath`]: #process_process_execpath
|
||||||
[`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
|
[`promise.catch()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
|
||||||
[`require.main`]: modules.html#modules_accessing_the_main_module
|
[`require.main`]: modules.html#modules_accessing_the_main_module
|
||||||
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_arg
|
[`setTimeout(fn, 0)`]: timers.html#timers_settimeout_callback_delay_args
|
||||||
[process_emit_warning]: #process_process_emitwarning_warning_name_ctor
|
[process_emit_warning]: #process_process_emitwarning_warning_name_ctor
|
||||||
[process_warning]: #process_event_warning
|
[process_warning]: #process_event_warning
|
||||||
[Signal Events]: #process_signal_events
|
[Signal Events]: #process_signal_events
|
||||||
|
@ -65,14 +65,14 @@ a certain period of time. When a timer's function is called varies depending on
|
|||||||
which method was used to create the timer and what other work the Node.js
|
which method was used to create the timer and what other work the Node.js
|
||||||
event loop is doing.
|
event loop is doing.
|
||||||
|
|
||||||
### setImmediate(callback[, ...arg])
|
### setImmediate(callback[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.9.1
|
added: v0.9.1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* `callback` {Function} The function to call at the end of this turn of
|
* `callback` {Function} The function to call at the end of this turn of
|
||||||
[the Node.js Event Loop]
|
[the Node.js Event Loop]
|
||||||
* `[, ...arg]` Optional arguments to pass when the `callback` is called.
|
* `...args` {any} Optional arguments to pass when the `callback` is called.
|
||||||
|
|
||||||
Schedules the "immediate" execution of the `callback` after I/O events'
|
Schedules the "immediate" execution of the `callback` after I/O events'
|
||||||
callbacks and before timers created using [`setTimeout()`][] and
|
callbacks and before timers created using [`setTimeout()`][] and
|
||||||
@ -87,7 +87,7 @@ next event loop iteration.
|
|||||||
|
|
||||||
If `callback` is not a function, a [`TypeError`][] will be thrown.
|
If `callback` is not a function, a [`TypeError`][] will be thrown.
|
||||||
|
|
||||||
### setInterval(callback, delay[, ...arg])
|
### setInterval(callback, delay[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.0.1
|
added: v0.0.1
|
||||||
-->
|
-->
|
||||||
@ -95,7 +95,7 @@ added: v0.0.1
|
|||||||
* `callback` {Function} The function to call when the timer elapses.
|
* `callback` {Function} The function to call when the timer elapses.
|
||||||
* `delay` {number} The number of milliseconds to wait before calling the
|
* `delay` {number} The number of milliseconds to wait before calling the
|
||||||
`callback`.
|
`callback`.
|
||||||
* `[, ...arg]` Optional arguments to pass when the `callback` is called.
|
* `...args` {any} Optional arguments to pass when the `callback` is called.
|
||||||
|
|
||||||
Schedules repeated execution of `callback` every `delay` milliseconds.
|
Schedules repeated execution of `callback` every `delay` milliseconds.
|
||||||
Returns a `Timeout` for use with [`clearInterval()`][].
|
Returns a `Timeout` for use with [`clearInterval()`][].
|
||||||
@ -105,7 +105,7 @@ set to `1`.
|
|||||||
|
|
||||||
If `callback` is not a function, a [`TypeError`][] will be thrown.
|
If `callback` is not a function, a [`TypeError`][] will be thrown.
|
||||||
|
|
||||||
### setTimeout(callback, delay[, ...arg])
|
### setTimeout(callback, delay[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.0.1
|
added: v0.0.1
|
||||||
-->
|
-->
|
||||||
@ -113,7 +113,7 @@ added: v0.0.1
|
|||||||
* `callback` {Function} The function to call when the timer elapses.
|
* `callback` {Function} The function to call when the timer elapses.
|
||||||
* `delay` {number} The number of milliseconds to wait before calling the
|
* `delay` {number} The number of milliseconds to wait before calling the
|
||||||
`callback`.
|
`callback`.
|
||||||
* `[, ...arg]` Optional arguments to pass when the `callback` is called.
|
* `...args` {any} Optional arguments to pass when the `callback` is called.
|
||||||
|
|
||||||
Schedules execution of a one-time `callback` after `delay` milliseconds.
|
Schedules execution of a one-time `callback` after `delay` milliseconds.
|
||||||
Returns a `Timeout` for use with [`clearTimeout()`][].
|
Returns a `Timeout` for use with [`clearTimeout()`][].
|
||||||
@ -168,6 +168,6 @@ Cancels a `Timeout` object created by [`setTimeout()`][].
|
|||||||
[`clearImmediate()`]: timers.html#timers_clearimmediate_immediate
|
[`clearImmediate()`]: timers.html#timers_clearimmediate_immediate
|
||||||
[`clearInterval()`]: timers.html#timers_clearinterval_timeout
|
[`clearInterval()`]: timers.html#timers_clearinterval_timeout
|
||||||
[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout
|
[`clearTimeout()`]: timers.html#timers_cleartimeout_timeout
|
||||||
[`setImmediate()`]: timers.html#timers_setimmediate_callback_arg
|
[`setImmediate()`]: timers.html#timers_setimmediate_callback_args
|
||||||
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg
|
[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args
|
||||||
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg
|
[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args
|
||||||
|
@ -88,12 +88,12 @@ The `--throw-deprecation` command line flag and `process.throwDeprecation`
|
|||||||
property take precedence over `--trace-deprecation` and
|
property take precedence over `--trace-deprecation` and
|
||||||
`process.traceDeprecation`.
|
`process.traceDeprecation`.
|
||||||
|
|
||||||
## util.format(format[, ...])
|
## util.format(format[, ...args])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.5.3
|
added: v0.5.3
|
||||||
-->
|
-->
|
||||||
|
|
||||||
* `format` {string} A `printf`-like format string.
|
* `format` {String} A `printf`-like format string.
|
||||||
|
|
||||||
The `util.format()` method returns a formatted string using the first argument
|
The `util.format()` method returns a formatted string using the first argument
|
||||||
as a `printf`-like format.
|
as a `printf`-like format.
|
||||||
@ -367,11 +367,11 @@ deprecated: v0.11.3
|
|||||||
|
|
||||||
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
|
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
|
||||||
|
|
||||||
* `string` {string} The message to print to `stderr`
|
* `string` {String} The message to print to `stderr`
|
||||||
|
|
||||||
Deprecated predecessor of `console.error`.
|
Deprecated predecessor of `console.error`.
|
||||||
|
|
||||||
### util.error([...])
|
### util.error([...strings])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.3.0
|
added: v0.3.0
|
||||||
deprecated: v0.11.3
|
deprecated: v0.11.3
|
||||||
@ -379,7 +379,7 @@ deprecated: v0.11.3
|
|||||||
|
|
||||||
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
|
> Stability: 0 - Deprecated: Use [`console.error()`][] instead.
|
||||||
|
|
||||||
* `string` {string} The message to print to `stderr`
|
* `...strings` {String} The message to print to `stderr`
|
||||||
|
|
||||||
Deprecated predecessor of `console.error`.
|
Deprecated predecessor of `console.error`.
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ deprecated: v6.0.0
|
|||||||
|
|
||||||
> Stability: 0 - Deprecated: Use a third party module instead.
|
> Stability: 0 - Deprecated: Use a third party module instead.
|
||||||
|
|
||||||
* `string` {string}
|
* `string` {String}
|
||||||
|
|
||||||
The `util.log()` method prints the given `string` to `stdout` with an included
|
The `util.log()` method prints the given `string` to `stdout` with an included
|
||||||
timestamp.
|
timestamp.
|
||||||
@ -792,7 +792,7 @@ const util = require('util');
|
|||||||
util.log('Timestamped message.');
|
util.log('Timestamped message.');
|
||||||
```
|
```
|
||||||
|
|
||||||
### util.print([...])
|
### util.print([...strings])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.3.0
|
added: v0.3.0
|
||||||
deprecated: v0.11.3
|
deprecated: v0.11.3
|
||||||
@ -802,7 +802,7 @@ deprecated: v0.11.3
|
|||||||
|
|
||||||
Deprecated predecessor of `console.log`.
|
Deprecated predecessor of `console.log`.
|
||||||
|
|
||||||
### util.puts([...])
|
### util.puts([...strings])
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.3.0
|
added: v0.3.0
|
||||||
deprecated: v0.11.3
|
deprecated: v0.11.3
|
||||||
@ -833,7 +833,7 @@ similar built-in functionality through [`Object.assign()`].
|
|||||||
[Customizing `util.inspect` colors]: #util_customizing_util_inspect_colors
|
[Customizing `util.inspect` colors]: #util_customizing_util_inspect_colors
|
||||||
[Custom inspection functions on Objects]: #util_custom_inspection_functions_on_objects
|
[Custom inspection functions on Objects]: #util_custom_inspection_functions_on_objects
|
||||||
[`Error`]: errors.html#errors_class_error
|
[`Error`]: errors.html#errors_class_error
|
||||||
[`console.log()`]: console.html#console_console_log_data
|
[`console.log()`]: console.html#console_console_log_data_args
|
||||||
[`console.error()`]: console.html#console_console_error_data
|
[`console.error()`]: console.html#console_console_error_data_args
|
||||||
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
|
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
|
||||||
[`Object.assign()`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
[`Object.assign()`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
||||||
|
Loading…
x
Reference in New Issue
Block a user