Commit Graph

41 Commits (aef61ee36713a38e62dbdc12e965a8a47da985f2)

Author SHA1 Message Date
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