cjihrig
7e4b0a4850
util: make util binding internal
...
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/22675
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-09-05 21:53:11 -04:00
Ruben Bridgewater
81bc23fe61
util: improve display of iterators and weak entries
...
This adds the number of not visible elements when inspecting iterators
while exceeding `maxArrayLength`.
It also fixes a edge case with `maxArrayLength` and the map.entries()
iterator. Now the whole entry will be visible instead of only the key
but not the value of the first entry.
Besides that it uses a slighly better algorithm that improves the
performance by skipping unnecessary steps.
PR-URL: https://github.com/nodejs/node/pull/20961
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-07-18 17:21:14 +02:00
Ruben Bridgewater
7eeb7948b3
console: fix timeEnd() not coercing the input
...
The input of console.timeEnd() was not coerced to a string. That way
labels were not found and the entry was not removed anymore.
PR-URL: https://github.com/nodejs/node/pull/21779
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-07-16 11:24:34 +02:00
Anna Henningsen
db49589624
console,util: avoid pair array generation in C++
...
Use a plain `[key, value, key, value]`-style list instead
of an array of pairs for inspecting collections.
This also fixes a bug with `console.table()` where
inspecting a non-key-value `MapIterator` would have
led to odd results.
PR-URL: https://github.com/nodejs/node/pull/20831
Refs: https://github.com/nodejs/node/pull/20719#discussion_r189342513
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-07-16 10:46:09 +02:00
Dominic Farolino
d4164ca559
console: console.countReset() should emit warning
...
The Console Standard specifies that console.countReset()
should emit some type of a warning when given a label that
has no previous account associated with it. This PR brings
node's implementation of console.countReset() up-to-spec and
adds a test asserting that a warning is emitted.
Fixes: https://github.com/nodejs/node/issues/20524
PR-URL: https://github.com/nodejs/node/pull/21649
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-07-12 07:42:29 -07:00
Michaël Zasso
b016745e48
console: implement timeLog method
...
Refs: https://github.com/whatwg/console/pull/138
PR-URL: https://github.com/nodejs/node/pull/21312
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-07-04 22:14:09 +02:00
Anna Henningsen
70cc5da0f1
lib,src: use V8 API for collection inspection
...
Use a new public V8 API for inspecting weak collections and
collection iterators, rather than using V8-internal functions
to achieve this. This currently comes with a slight modification of
the output for inspecting iterators generated by `Set().entries()`.
Fixes: https://github.com/nodejs/node/issues/20409
PR-URL: https://github.com/nodejs/node/pull/20719
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-05-19 01:02:14 +02:00
ohbarye
0c852a1795
console: .table fall back to logging for function too
...
According to the console.table documentation, it reads that it "falls
back to just logging the argument if it can’t be parsed as tabular."
But it doesn't fall back when I give a function as its first argument.
It logs an empty table. This is fixes by this commit.
PR-URL: https://github.com/nodejs/node/pull/20681
Fixes: https://github.com/nodejs/node/issues/20679
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-05-18 15:53:06 +02:00
Ruben Bridgewater
5dad1e45e9
console: lazy load cli
...
PR-URL: https://github.com/nodejs/node/pull/20567
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-05-18 15:27:29 +02:00
TSUYUSATO Kitsune
6af26b11b7
console: make console.table() use colored inspect
...
This makes `console.table()` inspect objects with color if available
like `console.log()`.
PR-URL: https://github.com/nodejs/node/pull/20510
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Jackson Tian <shyvo1987@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-08 03:27:37 +03:00
Gus Caplan
a59826403a
console: console.time() should not reset a timer when it exists
...
PR-URL: https://github.com/nodejs/node/pull/20442
Fixes: https://github.com/nodejs/node/issues/20440
Refs: https://console.spec.whatwg.org/#time
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-05-03 13:41:49 -05:00
Rich Trott
99d56a4749
console: fix console.table() display edge case
...
If the properties are not specified in `console.table()`, then we should
make a best effort to determine them rather than put all values into a
"Values" column.
PR-URL: https://github.com/nodejs/node/pull/20323
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-27 23:07:35 -07:00
Anatoli Papirovski
700344e388
console: fix class inheritance regression
...
Due to a return statement with new inside the function, extending
Console class does not work when passing in just the stdout arg.
PR-URL: https://github.com/nodejs/node/pull/20158
Fixes: https://github.com/nodejs/node/issues/20157
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-04-20 12:05:54 +02:00
Anna Henningsen
565fd50b4a
console: auto-detect color support by default
...
This makes Node pretty-print objects with color by default
when `console.log()`-ing them.
PR-URL: https://github.com/nodejs/node/pull/19372
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-12 23:23:57 +02:00
Anna Henningsen
57e8793c43
console: add color support
...
Add a way to tell `Console` instances to either always use, never use
or auto-detect color support and inspect objects accordingly.
PR-URL: https://github.com/nodejs/node/pull/19372
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-12 23:23:56 +02:00
Anna Henningsen
ce58df58d0
console: allow options object as constructor arg
...
PR-URL: https://github.com/nodejs/node/pull/19372
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-12 23:23:55 +02:00
Gus Caplan
97ace04492
console: add table method
...
PR-URL: https://github.com/nodejs/node/pull/18137
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-03-30 19:41:41 -05:00
Dan Kaplun
d49661bb80
console: don't swallow call stack exceeded errors
...
Fixes test/parallel/test-console-no-swallow-stack-exceeded.js
PR-URL: https://github.com/nodejs/node/pull/19423
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2018-03-25 20:03:17 -07:00
Ruben Bridgewater
7c8beb5b5f
console: port errors to new system
...
This ports the errors to the new error system.
PR-URL: https://github.com/nodejs/node/pull/18857
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2018-02-22 13:36:22 +00:00
Sarat Addepalli
c45afe8198
tools: non-Ascii linter for /lib only
...
Non-ASCII characters in /lib get compiled into the node binary,
and may bloat the binary size unnecessarily. A linter rule may
help prevent this.
PR-URL: https://github.com/nodejs/node/pull/18043
Fixes: https://github.com/nodejs/node/issues/11209
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Teddy Katz <teddy.katz@gmail.com >
2018-02-04 16:55:13 +01:00
Ruben Bridgewater
15d880bcb6
console: make .assert standard compliant
...
The standard does not throw and has no stack trace.
See https://console.spec.whatwg.org/#assert
PR-URL: https://github.com/nodejs/node/pull/17706
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2017-12-26 10:46:27 +01:00
Ruben Bridgewater
5b4d5321ee
console: order functions and remove \n\n
...
This lists all function aliases directly below the declared function.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-20 01:33:50 -03:00
Ruben Bridgewater
0eab49523d
benchmark: refactor console benchmark
...
Fix and refactor the console benchmark. It did not test console
so it got renamed and mainly tests the different ways of passing
arguments through.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-20 01:33:50 -03:00
Ruben Bridgewater
1d6b729cea
console: make variables and checks stricter
...
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-20 01:33:25 -03:00
Ruben Bridgewater
5198a5359b
console: make error handling engine agnostic
...
Calling write could throw a maximum call stack size error. To make
sure this is not specific to a single engine (version), lazily
populate the correct error message by producing such a error on
demand.
PR-URL: https://github.com/nodejs/node/pull/17707
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-20 01:33:06 -03:00
Benjamin Zaslavsky
c84710d062
console: make dirxml an alias for console.log
...
This method was previously exposed by V8 (since node 8.0.0) but not
implemented in node.
PR-URL: https://github.com/nodejs/node/pull/17152
Refs: https://github.com/nodejs/node/issues/17128
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-12-04 00:07:57 +01:00
Benjamin Zaslavsky
45e6642476
console: add support for console.debug
...
Adds the console.debug() method, alias for console.log(). This method is
exposed by V8 and was only available in inspector until now. Also adds
matching test and documentation.
PR-URL: https://github.com/nodejs/node/pull/17033
Refs: https://github.com/nodejs/node/pull/17004
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-11-18 12:38:59 +01:00
Matteo Collina
d82bedcb7b
console: avoid adding infinite error listeners
...
If the console destination is a unix pipe (net.Socket), write() is
async. If the destination is broken, we are adding an 'error' event
listener to avoid a process crash. This PR makes sure that we are adding
that listener only once.
Fixes: https://github.com/nodejs/node/issues/16767
PR-URL: https://github.com/nodejs/node/pull/16770
Fixes: https://github.com/nodejs/node/issues/16767
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2017-11-08 11:22:44 +00:00
Rich Trott
af11867b41
console: improve console.group()
...
Preserve indentation for multiline strings, objects that span multiple
lines, etc.
also make groupIndent non-enumerable
Hide the internal `groupIndent` key a bit by making it non-enumerable
and non-configurable.
PR-URL: https://github.com/nodejs/node/pull/14999
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com >
2017-08-25 11:29:33 -07:00
Rich Trott
c40229a9b8
console: implement minimal console.group()
...
Node.js exposes `console.group()` and `console.groupEnd()` via the
inspector. These functions have no apparent effect when called from
Node.js without the inspector. We cannot easily hide them when Node.js
is started without the inspector because we support opening the
inspector during runtime via `inspector.port()`.
Implement a minimal `console.group()`/`console.groupEnd()`. More
sophisticated implementations are possible, but they can be done in
userland and/or features can be added to this at a later time.
`console.groupCollapsed()` is implemented as an alias for
`console.group()`.
PR-URL: https://github.com/nodejs/node/pull/14910
Fixes: https://github.com/nodejs/node/issues/1716
Ref: https://github.com/nodejs/node/issues/12675
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2017-08-23 18:46:14 -07:00
James M Snell
4da8b99a74
console: coerce label to string in console.time()
...
Per the console spec, the label in console.time() is a string.
Per the console spec, the default value of label is `'default'`.
PR-URL: https://github.com/nodejs/node/pull/14643
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2017-08-07 22:22:59 -07:00
Anna Henningsen
fb3d0e25cb
console,test: make message test more accurate
...
Make a message test more accurate in what it’s testing for.
This requires not swallowing stack overflow RangeErrors in
`console.log` and similar methods, which I would consider a
bugfix in itself.
PR-URL: https://github.com/nodejs/node/pull/14580
Fixes: https://github.com/nodejs/node-v8/issues/5
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2017-08-03 15:41:14 +02:00
James M Snell
cc43c8fb54
console: add console.count() and console.clear()
...
Both are simple utility functions defined by the WHATWG
console spec (https://console.spec.whatwg.org/ ).
PR-URL: https://github.com/nodejs/node/pull/12678
Ref: https://github.com/nodejs/node/issues/12675
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2017-08-02 08:23:07 -07:00
Sebastiaan Deckers
bb29405904
lib,src: fix consistent spacing inside braces
...
PR-URL: https://github.com/nodejs/node/pull/14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-07-21 15:13:47 -04:00
Ruben Bridgewater
70b31adffa
console: use a plain object for the the error stack
...
Using a object instead of an Error is sufficient as the Error
itself won't be used but only the stack trace that would
otherwise be created twice.
This improves the overall .trace() performance.
PR-URL: https://github.com/nodejs/node/pull/13743
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Timothy Gu <timothygu99@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2017-06-22 14:12:51 -04:00
mskec
0ecdf29340
errors: migrate lib/console
...
Migrate console.js to use internal/errors.js.
PR-URL: https://github.com/nodejs/node/pull/11340
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2017-05-27 09:28:07 +02:00
James M Snell
98e54b0bd4
meta: restore original copyright header
...
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.
Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155
Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Anna Henningsen
c969047d62
console: fixup console.dir() error handling
...
Apply the `console: do not emit error events` changes properly
to `console.dir()`.
This was overlooked in f18e08d820
(https://github.com/nodejs/node/pull/9744 ).
Ref: https://github.com/nodejs/node/commit/f18e08d820dde161788d95a5603546ceca021e90#commitcomment-20934407
PR-URL: https://github.com/nodejs/node/pull/11443
Reviewed-By: James M Snell <jasnell@gmail.com >
2017-02-21 16:50:58 +01:00
Anna Henningsen
f18e08d820
console: do not emit error events
...
Fixes: https://github.com/nodejs/node/issues/831
Fixes: https://github.com/nodejs/node/issues/947
Ref: https://github.com/nodejs/node/pull/9470
PR-URL: https://github.com/nodejs/node/pull/9744
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2017-02-15 21:29:16 +01:00
Tyler Brazier
2ebd445e61
console: name anonymous functions
...
Ref: https://github.com/nodejs/node/issues/8913
PR-URL: https://github.com/nodejs/node/pull/9047
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2016-10-16 22:01:02 +02:00
Eugene Obrezkov
1c84579031
console: timeEnd() with no label emits warning
...
When timeEnd() provided with label that doesn't exists
it emits warning in the console, so developer get know about it.
PR-URL: https://github.com/nodejs/node/pull/5901
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2016-04-25 08:28:23 -07:00
James M Snell
33c242e7e9
console: refactor to use rest params and template strings
...
Overall cleanup in code, eliminate reliance on `arguments`.
Benchmarks show that as of v8 5.0.71.32, using rest params + apply
has good performance. The spread operator is not yet well optimized
in v8
```
misc/console.js method=restAndSpread concat=1 n=1000000: 374779.38359
misc/console.js method=restAndSpread concat=0 n=1000000: 375988.30434
misc/console.js method=argumentsAndApply concat=1 n=1000000: 682618.61125
misc/console.js method=argumentsAndApply concat=0 n=1000000: 645093.74443
misc/console.js method=restAndApply concat=1 n=1000000: 682931.41217
misc/console.js method=restAndApply concat=0 n=1000000: 664473.09700
```
PR-URL: https://github.com/nodejs/node/pull/6233
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-04-20 14:45:42 -07:00
Rich Trott
6ba5af2c2c
console: check that stderr is writable
...
`Console` constructor checks that `stdout.write()` is a function but
does not do an equivalent check for `stderr.write()`. If `stderr` is not
specified in the constructor, then `stderr` is set to be `stdout`.
However, if `stderr` is specified, but `stderr.write()` is not a
function, then an exception is not thrown until `console.error()` is
called.
This change adds the same check for 'stderr' in the constructor that is
there for `stdout`. If `stderr` fails the check, then a `TypeError` is
thrown.
Took the opportunity to copyedit the `console` doc a little too.
PR-URL: https://github.com/nodejs/node/pull/5635
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
2016-03-15 19:10:55 -07:00
Nathan Woltman
d0582ef9e1
lib: copy arguments object instead of leaking it
...
Instead of leaking the arguments object by passing it as an
argument to a function, copy it's contents to a new array,
then pass the array. This allows V8 to optimize the function
that contains this code, improving performance.
PR-URL: https://github.com/nodejs/node/pull/4361
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Brian White <mscdex@mscdex.net >
2016-03-10 18:45:08 -08:00
Jackson Tian
0903b6d8a8
console: apply null as this for util.format
...
Util.format is just a stateless function. Apply current console
as `this` is unnecessary.
PR-URL: https://github.com/nodejs/node/pull/5222
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
2016-02-18 11:24:01 +01:00
Vladimir Varankin
a5cce79ec3
console: delete timers that have ended
...
Currently, console timers that have been ended with timeEnd()
are not removed. This has the potential to leak memory. This
commit deletes ended timers from the containing Map.
PR-URL: https://github.com/nodejs/node/pull/3562
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Evan Lucas <evanlucas@me.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Michaël Zasso <mic.besace@gmail.com >
2015-11-13 11:36:45 -05:00
Roman Reiss
9aee2c0e26
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
8c043c1245 .
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: https://github.com/nodejs/node/pull/3590
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2015-11-10 15:37:06 +01:00
Michaël Zasso
8c043c1245
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: https://github.com/nodejs/node/pull/3166
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2015-10-16 21:03:44 +02:00
Michaël Zasso
419f7d4726
console: sub-millisecond accuracy for console.time
...
This makes the output of console.timeEnd in line with major browsers.
PR-URL: https://github.com/nodejs/node/pull/3166
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2015-10-16 21:00:51 +02:00
Yosuke Furukawa
19ffb5cf1c
lib: fix eslint styles
...
PR-URL: https://github.com/iojs/io.js/pull/1539
Fixes: https://github.com/iojs/io.js/issues/1253
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com >
Reviewed-By: Johan Bergström <bugs@bergstroem.nu >
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com >
2015-05-09 12:10:02 +09:00