Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5ed30da

Browse filesBrowse files
silverwindFishrock123
authored andcommitted
console: use 'label' argument for time and timeEnd
Turns out the argument is actually called label in the console spec, while being wrongly named on MDN. This reverts commit 8c043c1. MDN has been updated in: https://developer.mozilla.org/en-US/docs/Web/API/Console/timeEnd$compare?locale=en-US&to=947893&from=918571 https://developer.mozilla.org/en-US/docs/Web/API/Console/time$compare?locale=en-US&to=947891&from=896987 PR-URL: #3590 Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 8199784 commit 5ed30da
Copy full SHA for 5ed30da

File tree

Expand file treeCollapse file tree

2 files changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎doc/api/console.markdown‎

Copy file name to clipboardExpand all lines: doc/api/console.markdown
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ object. This is useful for inspecting large complicated objects. Defaults to
7272
- `colors` - if `true`, then the output will be styled with ANSI color codes.
7373
Defaults to `false`. Colors are customizable, see below.
7474

75-
### console.time(timerName)
75+
### console.time(label)
7676

7777
Starts a timer that can be used to compute the duration of an operation. Timers
7878
are identified by a unique name. Use the same name when you call
79-
[`console.timeEnd()`](#console_console_timeend_timername) to stop the timer and
79+
[`console.timeEnd()`](#console_console_timeend_label) to stop the timer and
8080
output the elapsed time in milliseconds. Timer durations are accurate to the
8181
sub-millisecond.
8282

83-
### console.timeEnd(timerName)
83+
### console.timeEnd(label)
8484

8585
Stops a timer that was previously started by calling
86-
[`console.time()`](#console_console_time_timername) and prints the result to the
86+
[`console.time()`](#console_console_time_label) and prints the result to the
8787
console.
8888

8989
Example:
Collapse file

‎lib/console.js‎

Copy file name to clipboardExpand all lines: lib/console.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@ Console.prototype.dir = function(object, options) {
5555
};
5656

5757

58-
Console.prototype.time = function(timerName) {
59-
this._times.set(timerName, process.hrtime());
58+
Console.prototype.time = function(label) {
59+
this._times.set(label, process.hrtime());
6060
};
6161

6262

63-
Console.prototype.timeEnd = function(timerName) {
64-
var time = this._times.get(timerName);
63+
Console.prototype.timeEnd = function(label) {
64+
var time = this._times.get(label);
6565
if (!time) {
66-
throw new Error('No such timer name: ' + timerName);
66+
throw new Error('No such label: ' + label);
6767
}
6868
const duration = process.hrtime(time);
6969
const ms = duration[0] * 1000 + duration[1] / 1e6;
70-
this.log('%s: %sms', timerName, ms.toFixed(3));
70+
this.log('%s: %sms', label, ms.toFixed(3));
7171
};
7272

7373

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.