0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

163 Commits

Author SHA1 Message Date
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
Wyatt Preul
5fcd6e4038 util: removed duplicated isArray check 2013-07-22 16:07:40 -07:00
Ben Noordhuis
0161ec87af src, lib: deduplicate errnoException 2013-07-20 12:04:35 +02:00
isaacs
896b2aa707 util: Add debuglog, deprecate console lookalikes 2013-05-21 16:39:50 -07:00
Nick Sullivan
8db693a87e util: make util.log handle non strings like console.log
util.log will fail on input that does not support .toString(). Have it
use console.log() instead. Includes tests for hairy data types.

Fixes #5349.
2013-05-13 12:35:17 +02:00
Marcin Kostrzewa
1f55704718 util: fix util.inspect() line width calculation
Have the formatter filter out vt100 color codes when calculating the
line width. Stops it from unnecessarily splitting strings over multiple
lines.

Fixes #5039.
2013-03-28 13:50:52 +01:00
Nathan Rajlich
66280de133 util: custom inspect() method may return an Object
This is more like how `JSON.stringify()` works.
Closes #2711.
2013-03-12 13:18:16 -07:00
isaacs
5038f40185 node: Add --throw-deprecation
Extremely handy when tracking down a flood of recursive nextTick warnings.
2013-03-06 11:44:29 -08:00
Ryunosuke SATO
27a91387ae util: fix deprecation message in util.pump 2012-12-26 14:54:56 -08:00
isaacs
8509073458 lint 2012-10-12 11:46:36 -07:00
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.
2012-10-10 14:40:36 -07:00
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.
2012-10-10 13:31:47 -07:00
isaacs
bb207c2827 Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	ChangeLog
	src/node_version.h
	test/simple/test-util-inspect.js
2012-09-12 15:13:07 -07:00
Nathan Rajlich
fb383a0ad0 util: make util.inspect() work when "hasOwnProperty" is overwritten 2012-09-08 15:09:59 -07:00
Ben Noordhuis
3219616f43 util: mark util.pump() as deprecated 2012-08-05 23:40:28 +02:00
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.
2012-07-16 18:32:03 -07:00
Jonas Westerlund
c7bc4cacde Use unicode escape sequences instead of octal
The latter is illegal in strict mode.
2012-07-06 19:28:35 -07:00
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.
2012-06-28 03:51:42 +02:00
isaacs
5b39929d47 Add --no-deprecation and --trace-deprecation flags 2012-06-21 12:05:33 -07:00
Ben Noordhuis
928d28a7b3 util: make _extend() more robust
Add a better 'is object?' check, the old one let values like true slip through.
2012-05-10 16:49:37 +02:00
Alex Kocharin
e85927119c util: handle non-string return value in .inspect() 2012-05-09 16:44:44 +02:00
ssuda
578ba76e6c util: fix util.format() formatting of %% 2012-03-03 18:22:34 +01:00
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.
2012-02-20 21:58:00 +01:00
Luke Gallagher
8d3c46daa8 util: fix typo in lib/util.js 2012-02-20 13:42:27 +01:00
Brandon Benvie
5403a8ce4c core: add NativeModule.prototype.deprecate
Formalize and cleanup handling of deprecated core methods.
2012-01-30 00:27:07 +01:00
Fedor Indutny
667aae596c Merge branch 'v0.6'
Conflicts:
	ChangeLog
	doc/template.html
	lib/cluster.js
	lib/http.js
	lib/tls.js
	src/node.h
	src/node_version.h
	test/simple/test-cluster-kill-workers.js
2012-01-24 00:30:28 +06:00
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.
2012-01-22 17:29:40 +09:00
Fedor Indutny
03e689fae4 Revert "util: always display a warning for module in debug mode"
This reverts commit df62005ece.
2012-01-16 19:33:16 +06:00
Maciej Małecki
df62005ece util: always display a warning for module in debug mode 2012-01-16 19:19:56 +06:00
Avi Flax
ee0a7b928b util: output Dates with Date.toString not Date.toUTCString 2011-12-18 23:07:47 +01:00
Ben Noordhuis
97900776bb util: add internal function _deprecationWarning() 2011-12-14 13:36:21 +01:00
Nathan Rajlich
b204006105 util: ensure that the .inspect function isn't the one being executed
Fixes #2225.
2011-11-30 14:14:24 +01:00
E. Azer Koçulu
1cb6fe47fc util: remove the line requiring events 2011-11-17 23:01:39 +01:00
Ryan Dahl
74f39041d4 dont use blue for numbers in util.inspect 2011-11-10 23:35:35 -08:00
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.
2011-10-27 04:58:34 +09:00
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.
2011-10-27 04:33:24 +09:00
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
2011-10-27 03:38:29 +09:00
Ryan Dahl
239b3d62de Remove resume and pause events
Too complex; unnecessary.
2011-10-24 13:23:59 -07: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
Colton Baker
87286cc737 Fixed a lot of jslint errors.
Fixes #1831
2011-10-05 18:51:06 -07:00
Ryan Dahl
8c87250816 Do not load readline from util.inspect
This causes all modules using console.log() to load readline which seems
unnecessary.
2011-09-12 18:25:23 -07:00
koichik
389e2a07e6 util: Fix inspection for Error
Fixes #1634.
2011-09-11 23:13:06 +09:00
koichik
6139459d45 util: Fix inspection for sparse array
Fixes #1651.
2011-09-09 00:57:42 +09:00
koichik
98b64422bb util: Divide inspect() into some subroutines 2011-09-09 00:53:37 +09:00
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.
2011-09-02 17:29:20 +02:00
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.
2011-08-15 17:22:48 +02:00
koichik
d439c092c2 Improve util.format() compatibility with browser.
Fixes #1434.
2011-08-08 23:24:05 +09:00
koichik
d3d8f1b972 Add %% escape to util.format()
Fixes #1273.
2011-07-30 23:56:17 +09:00
Ben Noordhuis
874260b40f util: add sprintf-like format() function
Fixes #1407.
2011-07-30 02:11:31 +02:00
koichik
d38fac2230 Fixes #1260
RegExp object is no longer Function.
http://code.google.com/p/v8/issues/detail?id=617
2011-07-08 17:18:42 -07:00
Ryan Dahl
d1eba2b18b Revert "Fixes #1260"
Due to downgrade of V8.

This reverts commit 3e2abd12d3.
2011-07-05 16:49:13 -07:00
koichik
3e2abd12d3 Fixes #1260
RegExp object is no longer Function.
http://code.google.com/p/v8/issues/detail?id=617
2011-07-03 12:19:44 -07:00
Ryan Dahl
1ba2c32135 Massage util.inherits for perf increase 2011-06-11 08:51:48 +02:00
isaacs
4d64f36338 Closes GH-310 Format slashes properly 2011-04-01 17:40:19 -07:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Devin Torres
8c6a7b5de4 Use more color in the repl, loosely inspired by TextMate's SunBurst theme 2010-12-03 16:07:20 -08:00
Ryan Dahl
558e5ba2b0 lint util.js and src/node.js 2010-12-02 12:27:26 -08:00
Ryan Dahl
dd53ceebe4 lint 2010-12-01 20:59:06 -08:00
Tim Cooijmans
d4b726a1a6 fix utils.inspect's detection of circular structures 2010-11-17 16:06:17 -08:00
Micheil Smith
e38eb0c5a4 Soft migration of sys -> util, Removal of deprecated utils module. 2010-10-11 15:21:36 -07:00
Karl Guertin
4f679fd8d0 Dependency free assert module with unit tests 2009-12-05 01:05:16 +01:00
Felix Geisendörfer
530328f12b CommonJS testing for node.js
Refactored test suite to use the assert module for testing rather than
mjsunit.
2009-12-05 01:05:16 +01:00