Rod Vagg
250782d139
util: format as Error if instanceof Error
Conflicts:
lib/util.js
test/simple/test-util-format.js
This is a backport to fix #7253
Signed-off-by: Fedor Indutny <fedor@indutny.com>
11 years ago
isaacs
5038f40185
node: Add --throw-deprecation
Extremely handy when tracking down a flood of recursive nextTick warnings.
12 years ago
Ryunosuke SATO
27a91387ae
util: fix deprecation message in `util.pump`
12 years ago
isaacs
8509073458
lint
12 years ago
Nathan Rajlich
4eb5399bb2
util: add a "customInspect" option to `util.inspect()`
For disabling calling the custom `inspect()` function when defined on an object
that is being inspected.
12 years ago
Nathan Rajlich
07774e6b95
util: make `inspect()` accept an "options" argument
Consolidates all the formatting options into an "options" object argument.
This is so that we don't have to be constantly remembering the order of
the arguments and so that we can add more formatting options easily.
Closes #4085 .
12 years ago
Nathan Rajlich
fb383a0ad0
util: make util.inspect() work when "hasOwnProperty" is overwritten
12 years ago
Ben Noordhuis
3219616f43
util: mark util.pump() as deprecated
13 years ago
Pavel Lang
ff14007573
Enable color customization of `util.inspect`
This is rewrite of #3701 and #3603 before.
This patch introduce `util.inspect.styles`
and `util.inspect.colors` objects, which enables customization
of color sequences.
13 years ago
Jonas Westerlund
c7bc4cacde
Use unicode escape sequences instead of octal
The latter is illegal in strict mode.
13 years ago
Ben Noordhuis
6531f187d8
util: speed up formatting of large arrays/objects
Don't .indexOf() into the keys array. V8 is smart but not so smart that it
knows how to turn the linear scan into a O(1) lookup.
Fixes #3562 .
13 years ago
isaacs
5b39929d47
Add --no-deprecation and --trace-deprecation flags
13 years ago
Ben Noordhuis
928d28a7b3
util: make _extend() more robust
Add a better 'is object?' check, the old one let values like true slip through.
13 years ago
Alex Kocharin
e85927119c
util: handle non-string return value in .inspect()
13 years ago
ssuda
578ba76e6c
util: fix util.format() formatting of %%
13 years ago
Maciej Małecki
c6c6f98f1c
util: add `util._extend` for extending objects
There were 2 duplicates with such functionality in `cluster` and
`child_process` modules which were replaced by this function.
13 years ago
Luke Gallagher
8d3c46daa8
util: fix typo in lib/util.js
13 years ago
Brandon Benvie
5403a8ce4c
core: add `NativeModule.prototype.deprecate`
Formalize and cleanup handling of deprecated core methods.
13 years ago
Brandon Benvie
f9014438c7
util: use getOwnPropertyDescripter
Change formatProperty in util.js to use Object.getOwnPropertyDescriptor
instead of __lookup[GS]etter__.
Use the cached value from the descriptor to reduce number of property
lookups from 3 to 1.
Fallback to standard lookup if the descriptor is empty. This doesn't
ever happen with normal JS objects (this function is called only when
the key exists) but apparently does with Node's custom ENV interface.
Fixes : #2109 .
13 years ago
Fedor Indutny
03e689fae4
Revert "util: always display a warning for module in debug mode"
This reverts commit df62005ece
.
13 years ago
Maciej Małecki
df62005ece
util: always display a warning for module in debug mode
13 years ago
Avi Flax
ee0a7b928b
util: output Dates with Date.toString not Date.toUTCString
13 years ago
Ben Noordhuis
97900776bb
util: add internal function _deprecationWarning()
13 years ago
Nathan Rajlich
b204006105
util: ensure that the .inspect function isn't the one being executed
Fixes #2225 .
13 years ago
E. Azer Koçulu
1cb6fe47fc
util: remove the line requiring events
13 years ago
E. Azer Koçulu
e258169666
util: remove the line requiring events
13 years ago
Ryan Dahl
74f39041d4
dont use blue for numbers in util.inspect
13 years ago
Nathan Rajlich
ebefe77bc0
More bulletproof `util.inspect()` function.
Use the *real* versions of the Date and RegExp functions, from the
prototype. This defends against code like:
var d = new Date()
d.toUTCString = null
util.inspect(d)
// TypeError: toUTCString is not a function
Fixes #1944 .
13 years ago
Nathan Rajlich
2dbb470ea1
Don't use `instanceof` in lib/util.js "is" checks.
While using `instanceof`, these functions could easily be faked with something
like: Object.create(Date.prototype)
So let's just not use it at all. A little slower, but these functions are only
used in the REPL / for debugging so it's OK.
Fixes #1941 .
Fixes #1942 .
13 years ago
Nathan Rajlich
b8f3e18a5d
Export the type checking functions from `util.js`.
As per discussion at:
http://groups.google.com/group/nodejs-dev/browse_thread/thread/b08970166e4670cf
13 years ago
Ryan Dahl
239b3d62de
Remove resume and pause events
Too complex; unnecessary.
13 years ago
Ryan Dahl
d77ce4b998
Fixes #1860 . Remove process.writeError
Breaks a few tests in "make test-message"
13 years ago
Ryan Dahl
cdf5d91fe5
Remove tty_legacy
13 years ago
Colton Baker
87286cc737
Fixed a lot of jslint errors.
Fixes #1831
13 years ago
Nathan Rajlich
0c91a835ff
util: isRegExp() should not call toString() on its argument
An overloaded toString() method may have side effects
so don't call it for a simple type check.
Back-port of 54b409d
to the v0.4 branch.
14 years ago
Ryan Dahl
8c87250816
Do not load readline from util.inspect
This causes all modules using console.log() to load readline which seems
unnecessary.
13 years ago
koichik
389e2a07e6
util: Fix inspection for Error
Fixes #1634 .
13 years ago
koichik
6139459d45
util: Fix inspection for sparse array
Fixes #1651 .
13 years ago
koichik
98b64422bb
util: Divide inspect() into some subroutines
13 years ago
Nathan Rajlich
44574bc39b
util: improve util.isDate() function
The old implementation was fragile. i.e. node-time is an example of a user-land
module that exports an extended Date object (with a few added functions on it's
own Date object's prototype). In that case, the old check fails.
14 years ago
Nathan Rajlich
54b409d650
util: isRegExp() should not call toString() on its argument
An overloaded toString() method may have side effects
so don't call it for a simple type check.
14 years ago
koichik
d439c092c2
Improve util.format() compatibility with browser.
Fixes #1434 .
14 years ago
koichik
d3d8f1b972
Add %% escape to util.format()
Fixes #1273 .
14 years ago
Ben Noordhuis
874260b40f
util: add sprintf-like format() function
Fixes #1407 .
14 years ago
koichik
d38fac2230
Fixes #1260
RegExp object is no longer Function.
http://code.google.com/p/v8/issues/detail?id=617
14 years ago
Ryan Dahl
d1eba2b18b
Revert "Fixes #1260"
Due to downgrade of V8.
This reverts commit 3e2abd12d3
.
14 years ago
koichik
3e2abd12d3
Fixes #1260
RegExp object is no longer Function.
http://code.google.com/p/v8/issues/detail?id=617
14 years ago
Ryan Dahl
1ba2c32135
Massage util.inherits for perf increase
14 years ago
isaacs
4d64f36338
Closes GH-310 Format slashes properly
14 years ago
Ryan Dahl
55048cdf79
Update copyright headers
14 years ago