Brendan Ashworth
626432d843
util: dont repeat isBuffer
...
PR-URL: https://github.com/nodejs/io.js/pull/1988
Reviewed-By: Roman Reiss <me@silverwind.io >
2015-06-16 16:08:15 -07:00
Brendan Ashworth
1d79f572f1
util: move deprecate() to internal module
...
PR-URL: https://github.com/nodejs/io.js/pull/1988
Reviewed-By: Roman Reiss <me@silverwind.io >
2015-06-16 16:06:45 -07:00
Roman Reiss
b5b8ff117c
lib: don't use global Buffer
...
Port of https://github.com/joyent/node/pull/8603
The race condition present in the original PR didn't occur, so no
workaround was needed.
PR-URL: https://github.com/nodejs/io.js/pull/1794
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
2015-06-11 20:24:44 +02:00
Vladimir Kurchatkin
628845b816
util: introduce printDeprecationMessage function
...
`printDeprecationMessage` is used to deprecate modules
and execution branches.
PR-URL: https://github.com/nodejs/io.js/pull/1822
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-06-04 10:59:43 +03:00
Сковорода Никита Андреевич
214d02040e
util: speed up common case of formatting string
...
PR-URL: https://github.com/nodejs/io.js/pull/1749
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2015-05-20 23:28:52 +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
Rod Vagg
702997c1f0
Revert "url: significantly improve the performance of the url module"
...
This reverts commit 3fd7fc429c .
It was agreed that this change contained too much potential ecosystem
breakage, particularly around the inability to `delete` properties off a
`Url` object. It may be re-introduced for a later release, along with
better work on ecosystem compatibility.
PR-URL: https://github.com/iojs/io.js/pull/1602
Reviewed-By: Mikeal Rogers <mikeal.rogers@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Forrest L Norvell <forrest@npmjs.com >
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com >
Reviewed-By: Isaac Z. Schlueter <i@izs.me >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2015-05-03 20:29:41 -07:00
Petka Antonov
3fd7fc429c
url: significantly improve the performance of the url module
...
(landed by @rvagg)
PR-URL: https://github.com/iojs/io.js/pull/1561
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
2015-05-01 23:12:52 -07:00
Christopher Monsanto
bf7ac08dd0
util: add Map and Set inspection support
...
PR-URL: https://github.com/iojs/io.js/pull/1471
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com >
2015-04-25 19:05:18 -07:00
Brendan Ashworth
1219e7466c
lib: reduce process.binding() calls
...
This commit better handles calls to process.binding() in lib/ by
no longer lazy loading the bindings (the load times themselves are
rather miniscule compared to the load time of V8) and never reloading
the bindings (which is 172 times slower than referencing a variable with
the same value).
PR-URL: https://github.com/iojs/io.js/pull/1367
Reviewed-By: Brian White <mscdex@mscdex.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-04-09 10:51:19 -07:00
Brian White
4dc6ae2181
lib: remove unused variables
...
PR-URL: https://github.com/iojs/io.js/pull/1290
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-03-31 15:58:42 -04:00
Connor Peet
849319a260
util: Check input to util.inherits
...
PR-URL: https://github.com/iojs/io.js/pull/1240
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com >
Reviewed-By: Petka Antonov <petka_antonov@hotmail.com >
2015-03-22 20:45:35 -07:00
cjihrig
ed3b057e9f
util: handle symbols properly in format()
...
Currently, if util.format() is called with a string as its first
argument, and a Symbol as one of the subsequent arguments, an
exception is thrown due to an attempted implicit string conversion.
This commit causes Symbols to be explicitly converted.
Fixes: https://github.com/iojs/io.js/issues/927
PR-URL: https://github.com/iojs/io.js/pull/931
Reviewed-By: Domenic Denicola <domenic@domenicdenicola.com >
2015-02-24 10:14:24 -05:00
Vladimir Kurchatkin
b9d3928f80
util: simplify isPrimitive
...
Everything that is not an object should be a primitive.
PR-URL: https://github.com/iojs/io.js/pull/739
Reviewed-By: Trevor Norris <trev.norris@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-02-07 17:41:44 +03:00
cjihrig
6ac8bdc0ab
lib: reduce util.is*() usage
...
Many of the util.is*() methods used to check data types
simply compare against a single value or the result of
typeof. This commit replaces calls to these methods with
equivalent checks. This commit does not touch calls to the
more complex methods (isRegExp(), isDate(), etc.).
Fixes: https://github.com/iojs/io.js/issues/607
PR-URL: https://github.com/iojs/io.js/pull/647
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-01-31 23:47:29 -05:00
cjihrig
804e7aa9ab
lib: use const to define constants
...
This commit replaces a number of var statements throughout
the lib code with const statements.
PR-URL: https://github.com/iojs/io.js/pull/541
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-01-21 16:21:31 -05:00
Yosuke Furukawa
fd30eb2152
src: fix jslint errors
...
PR-URL: https://github.com/iojs/io.js/pull/449
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
2015-01-15 21:21:31 +01:00
isaacs
3e1b1dd4a9
Remove excessive copyright/license boilerplate
...
The copyright and license notice is already in the LICENSE file. There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Evan Lucas
b1a208c83c
util: _detailedException to _exceptionWithHostPort
...
The _detailedException() helper function used to be local to the 'net'
module, but now that it has been moved to 'util' a more descriptive name
is desirable.
PR-URL: https://github.com/iojs/io.js/pull/250
Reviewed-By: Bert Belder <bertbelder@gmail.com >
2015-01-08 20:16:38 +01:00
Evan Lucas
3937e8566d
util,net: move _detailedException into util
...
This allows _detailedException() to be used by both the 'net' and
'dgram' modules to provide more informative error messages.
PR-URL: https://github.com/iojs/io.js/pull/250
Reviewed-By: Bert Belder <bertbelder@gmail.com >
2015-01-08 20:15:01 +01:00
Vladimir Kurchatkin
c70d192ab3
util: show symbol properties
...
Properties with symbol names are shown if option `showHidden` of `util.inspect`
or `console.dir` is `true`.
PR-URL: https://github.com/iojs/io.js/pull/247
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Rod Vagg <rod@vagg.org >
2015-01-08 11:20:15 +01:00
Ben Noordhuis
21130c7d6f
lib: turn on strict mode
...
Turn on strict mode for the files in the lib/ directory. It helps
catch bugs and can have a positive effect on performance.
PR-URL: https://github.com/node-forward/node/pull/64
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Fedor Indutny <fedor@indutny.com >
2014-11-22 17:23:30 +01:00
gyson
cb97bcd6f9
util: add es6 Symbol support for util.inspect
...
* `util.inspect` cannot accept es6 symbol primitive
* It will throw exception if do `util.inspect(Symbol())`
* This also affects repl, console.log, etc.
Reviewed-by: Trevor Norris <trev.norris@gmail.com >
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com >
2014-10-03 10:12:00 -07:00
Evan Carroll
95dbb6bf64
util: made util.isArray a direct alias for Array.isArray
2014-04-03 22:39:42 +04:00
Yuki KAN
006d42786e
lib: use triple equals
...
Signed-off-by: Trevor Norris <trev.norris@gmail.com >
2014-04-02 02:12:18 -07:00
Nathan Rajlich
8874a31748
util: show meaningful values for boxed primitives
...
Before, `new String('foo')` would be inspected as `"{}"` which
is simply not very helpful. Now, a more meaningful
`"[String: 'foo']"` result will be returned from `util.inspect()`.
Boxed String, Boolean, and Number types are all supported.
Closes #7047
2014-02-06 14:19:47 +04:00
Thom Seddon
8eaa1ac463
lib: Remove unused var+operations in util.inspect
...
This was originally introduced in 6034701 to prevent the closing
brace being pushed onto the next line if an object is longer than
the max width, however the functionality was removed in d164989 but
the supplementary variables (and operations) were left behind
2014-01-29 03:08:06 +04:00
Fedor Indutny
640912d18a
tls_wrap: propagate errors to write callbacks
...
fix #6903
2014-01-24 22:09:42 +04:00
Tom Gallacher
38a07a929b
util: handle escaped forward slashes correctly
...
Fixes #6835
2014-01-10 21:13:46 +00:00
Trevor Norris
87cde44280
Revert "util: more strict check for bool/number/string"
...
This reverts commit 95ee84fabe .
2013-12-20 13:44:56 -08:00
Yorkie
95ee84fabe
util: more strict check for bool/number/string
2013-12-18 17:58:02 +04:00
David Chan
b3e4fc6a48
util: Format negative zero as '-0'
...
Format negative zero as '-0' instead of as '0', as it does not behave
identically to positive zero. ((-0).toString() still returns '0' as
required by ES5 9.8.1.2).
Fixes joyent/node#6548 .
Closes joyent/node#6550 .
2013-11-25 11:28:30 -08:00
Rod Vagg
684dd28a6c
util: format as Error if instanceof Error
2013-10-15 10:30:58 +02:00
Timothy J Fontaine
546ae2eef9
util: pass opts to custom inspect functions
...
Objects with custom inpsect functions should get the options that were
passed to `util.inspect()`
fixes #5822
fixes #6098
2013-08-22 16:54:17 -07:00
Trevor Norris
50cee6ecab
util: isObject should always return boolean
...
Fix small bug where isObject would return the original object instead of
true.
2013-08-20 11:05:36 -07:00
Trevor Norris
d66d840e3b
util: fix isPrimitive check
...
Previous check failed for the edge case Object.create(null). This uses
the current v8 code for the check.
2013-08-12 13:48:56 -07:00
Trevor Norris
3158ffb6ef
util: add isPrimitive check
2013-08-02 12:52:34 -07:00
isaacs
22c68fdc1d
src: Replace macros with util functions
2013-08-01 15:08:01 -07:00
Ben Noordhuis
2cd7adc7f4
util: don't throw on circular %j input to format()
...
Don't throw an exception when the argument to %j is an object that
contains circular references, it's not helpful. Catch the exception
and return the string '[Circular]'.
2013-07-29 21:59:15 +02: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
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