From 929d9bb2224b5527795f2e8bd4c36c5db88b4ae5 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 29 Aug 2016 22:35:03 -0700 Subject: [PATCH] doc: standardize rest parameters PR-URL: https://github.com/nodejs/node/pull/8485 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- doc/api/console.md | 18 +++++++++--------- doc/api/domain.md | 7 ++++--- doc/api/events.md | 2 +- doc/api/globals.md | 12 ++++++------ doc/api/path.md | 8 ++++---- doc/api/process.md | 7 +++---- doc/api/timers.md | 18 +++++++++--------- doc/api/util.md | 20 ++++++++++---------- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index 74850c0c2e0c9f..7b8d893197473f 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -100,7 +100,7 @@ The global `console` is a special `Console` whose output is sent to new Console(process.stdout, process.stderr); ``` -### console.assert(value[, message][, ...]) +### console.assert(value[, message][, ...args]) @@ -177,7 +177,7 @@ Defaults to `2`. To make it recurse indefinitely, pass `null`. Defaults to `false`. Colors are customizable; see [customizing `util.inspect()` colors][]. -### console.error([data][, ...]) +### console.error([data][, ...args]) @@ -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 values are concatenated. See [`util.format()`][] for more information. -### console.info([data][, ...]) +### console.info([data][, ...args]) The `console.info()` function is an alias for [`console.log()`][]. -### console.log([data][, ...]) +### console.log([data][, ...args]) @@ -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 functionality was unintended and is no longer supported.* -### console.trace(message[, ...]) +### console.trace(message[, ...args]) @@ -284,20 +284,20 @@ console.trace('Show me'); // at REPLServer.Interface._ttyWrite (readline.js:826:14) ``` -### console.warn([data][, ...]) +### console.warn([data][, ...args]) The `console.warn()` function is an alias for [`console.error()`][]. -[`console.error()`]: #console_console_error_data -[`console.log()`]: #console_console_log_data +[`console.error()`]: #console_console_error_data_args +[`console.log()`]: #console_console_log_data_args [`console.time()`]: #console_console_time_label [`console.timeEnd()`]: #console_console_timeend_label [`process.stderr`]: process.html#process_process_stderr [`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 [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 diff --git a/doc/api/domain.md b/doc/api/domain.md index 2fe7e2c39af718..e1dd65e05c45d3 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -269,9 +269,10 @@ uncaught exceptions to the active Domain object. Domain is a child class of [`EventEmitter`][]. To handle the errors that it catches, listen to its `'error'` event. -### domain.run(fn[, arg][, ...]) +### domain.run(fn[, ...args]) * `fn` {Function} +* `...args` {any} Run the supplied function in the context of the domain, implicitly binding all event emitters, timers, and lowlevel requests that are @@ -449,6 +450,6 @@ is emitted. [`domain.exit()`]: #domain_domain_exit [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html#events_class_eventemitter -[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg -[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg +[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args +[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args [`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw diff --git a/doc/api/events.md b/doc/api/events.md index 6b19287881c132..7affd97ef37dc0 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -293,7 +293,7 @@ added: v0.1.26 Alias for `emitter.on(eventName, listener)`. -### emitter.emit(eventName[, arg1][, arg2][, ...]) +### emitter.emit(eventName[, ...args]) diff --git a/doc/api/globals.md b/doc/api/globals.md index 63fbf64f6e3d25..85eda3169b0871 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -182,19 +182,19 @@ left untouched. Use the internal `require()` machinery to look up the location of a module, but rather than loading the module, just return the resolved filename. -## setImmediate(callback[, arg][, ...]) +## setImmediate(callback[, ...args]) [`setImmediate`] is described in the [timers][] section. -## setInterval(callback, delay[, arg][, ...]) +## setInterval(callback, delay[, ...args]) [`setInterval`] is described in the [timers][] section. -## setTimeout(callback, delay[, arg][, ...]) +## setTimeout(callback, delay[, ...args]) @@ -210,7 +210,7 @@ but rather than loading the module, just return the resolved filename. [`clearImmediate`]: timers.html#timers_clearimmediate_immediate [`clearInterval`]: timers.html#timers_clearinterval_timeout [`clearTimeout`]: timers.html#timers_cleartimeout_timeout -[`setImmediate`]: timers.html#timers_setimmediate_callback_arg -[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg -[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg +[`setImmediate`]: timers.html#timers_setimmediate_callback_args +[`setInterval`]: timers.html#timers_setinterval_callback_delay_args +[`setTimeout`]: timers.html#timers_settimeout_callback_delay_args [built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects diff --git a/doc/api/path.md b/doc/api/path.md index eb7d9766bc4b80..e99d34f1e341b5 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -272,12 +272,12 @@ path.isAbsolute('.') // false A [`TypeError`][] is thrown if `path` is not a string. -## path.join([path[, ...]]) +## path.join([...paths]) -* `[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 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. -## path.resolve([path[, ...]]) +## path.resolve([...paths]) -* `[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 an absolute path. diff --git a/doc/api/process.md b/doc/api/process.md index fd67f55dbe2e1d..94c5f2dc919002 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1143,14 +1143,13 @@ Will generate: `heapTotal` and `heapUsed` refer to V8's memory usage. -## process.nextTick(callback[, arg][, ...]) +## process.nextTick(callback[, ...args]) * `callback` {Function} -* `[, arg][, ...]` {any} Additional arguments to pass when invoking the - `callback` +* `...args` {any} Additional arguments to pass when invoking the `callback` 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 @@ -1705,7 +1704,7 @@ cases: [`process.execPath`]: #process_process_execpath [`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 -[`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_warning]: #process_event_warning [Signal Events]: #process_signal_events diff --git a/doc/api/timers.md b/doc/api/timers.md index e356d2d672d793..b833e06d6e3336 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -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 event loop is doing. -### setImmediate(callback[, ...arg]) +### setImmediate(callback[, ...args]) * `callback` {Function} The function to call at the end of this turn of [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' 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. -### setInterval(callback, delay[, ...arg]) +### setInterval(callback, delay[, ...args]) @@ -95,7 +95,7 @@ added: v0.0.1 * `callback` {Function} The function to call when the timer elapses. * `delay` {number} The number of milliseconds to wait before calling the `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. 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. -### setTimeout(callback, delay[, ...arg]) +### setTimeout(callback, delay[, ...args]) @@ -113,7 +113,7 @@ added: v0.0.1 * `callback` {Function} The function to call when the timer elapses. * `delay` {number} The number of milliseconds to wait before calling the `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. Returns a `Timeout` for use with [`clearTimeout()`][]. @@ -168,6 +168,6 @@ Cancels a `Timeout` object created by [`setTimeout()`][]. [`clearImmediate()`]: timers.html#timers_clearimmediate_immediate [`clearInterval()`]: timers.html#timers_clearinterval_timeout [`clearTimeout()`]: timers.html#timers_cleartimeout_timeout -[`setImmediate()`]: timers.html#timers_setimmediate_callback_arg -[`setInterval()`]: timers.html#timers_setinterval_callback_delay_arg -[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_arg +[`setImmediate()`]: timers.html#timers_setimmediate_callback_args +[`setInterval()`]: timers.html#timers_setinterval_callback_delay_args +[`setTimeout()`]: timers.html#timers_settimeout_callback_delay_args diff --git a/doc/api/util.md b/doc/api/util.md index 03d6f4d8f923f2..3cd80cb5dc2941 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -88,12 +88,12 @@ The `--throw-deprecation` command line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation` and `process.traceDeprecation`. -## util.format(format[, ...]) +## util.format(format[, ...args]) -* `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 as a `printf`-like format. @@ -367,11 +367,11 @@ deprecated: v0.11.3 > 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`. -### util.error([...]) +### util.error([...strings])