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 a89eeca

Browse filesBrowse files
targosrvagg
authored andcommitted
console: rename argument of time and timeEnd
Name it timerName instead of label. It is clearer that way and matches the description in the doc. It is also how it's named in MDN. PR-URL: #3166 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent f6ebc82 commit a89eeca
Copy full SHA for a89eeca

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(label)
75+
### console.time(timerName)
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_label) to stop the timer and
79+
[`console.timeEnd()`](#console_console_timeend_timername) 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(label)
83+
### console.timeEnd(timerName)
8484

8585
Stops a timer that was previously started by calling
86-
[`console.time()`](#console_console_time_label) and prints the result to the
86+
[`console.time()`](#console_console_time_timername) 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(label) {
59-
this._times.set(label, process.hrtime());
58+
Console.prototype.time = function(timerName) {
59+
this._times.set(timerName, process.hrtime());
6060
};
6161

6262

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