20 Commits

Author SHA1 Message Date
Julien Gilli
ef4344311e src: enable strict mode in all builtin modules
This is a follow-up commit for b233131901.

It enables strict mode in all built-in modules.

PR: #9302
PR-URL: https://github.com/joyent/node/pull/9302
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-03-03 15:52:30 -08:00
Julien Gilli
b233131901 src: fix builtin modules failing with --use-strict
Currently, lib/_tls_legacy.js and lib/crypto.js cannot be loaded when
--use-strict is passed to node. In addition to that, console.trace
throws because it uses arguments.callee.

This change fixes these issues and adds a test that makes sure
every external built-in module can be loaded with require when
--use-strict is enabled.

Please note that this change does not fix all issues with built-in
modules' code running with --use-strict. It is very likely that some
code in the built-in modules still fails when passing this flag.

However, fixing all code would require us to enable strict mode by
default in all builtins modules, which would certainly break existing
applications.

Fixes #9187.

PR: #9237
PR-URL: https://github.com/joyent/node/pull/9237
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-02-27 16:28:57 -08:00
cjihrig
6c3647c38d console: allow Object.prototype fields as labels
Console.prototype.timeEnd() returns NaN if the timer label
corresponds to a property on Object.prototype. This commit
uses Object.create(null) to construct the _times object.

Fixes: https://github.com/joyent/node/issues/9069
PR-URL: https://github.com/joyent/node/pull/9116
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-02-13 10:22:30 -05:00
Majid Arif Siddiqui
176f0bd3df lib: improved forEach object performance
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-09-05 09:19:32 -07:00
Xavi Magrinyà
1cd48c7ae5 console: console.dir() accepts options object
This features comes from the need of adding extra options when displaying
the object using console.dir().

console.dir() accepts now a second parameter that is passed to util.inspect()
in order to provide extra options to the output. These options are: depth, color
and showHidden. More information about these options in util.inspect() documentation.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-12 10:42:52 -07:00
Xavi Magrinyà
e00cafa311 Added support for options parameter in console.dir()
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-12 10:33:15 -07:00
isaacs
22c68fdc1d src: Replace macros with util functions 2013-08-01 15:08:01 -07:00
Ben Noordhuis
0330bdf519 lib: macro-ify type checks
Increases the grep factor. Makes it easier to harmonize type checks
across the code base.
2013-07-24 21:49:35 +02:00
Nathan Rajlich
da8b0eefde console: console.dir() bypasses inspect() methods
Use the `customInspect: false` option of `util.inspect()` to bypass any custom
inspect() function on the object being logged.

Closes #2717.
2013-03-12 13:15:03 -07:00
isaacs
539bf1d7b7 console: Support formatting options in trace()
Fix #4589
2013-01-18 15:39:08 -08:00
Nathan Rajlich
025f53c306 console: refactor the console module to be reusable
So that multiple instances can be created pointing
to different writable streams.

This is needed for #3876.
2012-08-24 14:31:32 -07:00
Maciej Małecki
77c18d1e1b console: throw when no such label exists in console.timeEnd
Test included.
2012-04-29 22:27:45 +02:00
Ryan Dahl
d77ce4b998 Fixes #1860. Remove process.writeError
Breaks a few tests in "make test-message"
2011-10-18 13:12:50 -07:00
Ryan Dahl
cdf5d91fe5 Remove tty_legacy 2011-10-11 13:41:33 -07:00
Ben Noordhuis
874260b40f util: add sprintf-like format() function
Fixes #1407.
2011-07-30 02:11:31 +02:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
bfb6a67d60 Another fix for process.assert 2011-01-27 16:59:28 -08:00
Sami Samhuri
e5a47c8ce1 use util.inspect to format objects and arrays printed to the console 2010-12-30 19:14:30 -08:00
Ryan Dahl
f22c248e4c more lint 2010-12-01 17:29:11 -08:00
Ryan Dahl
70188499b0 Lazy load console object 2010-11-30 11:18:02 -08:00