summaryrefslogtreecommitdiff
path: root/lib/util.js
Commit message (Collapse)AuthorAgeFilesLines
* src: enable strict mode in all builtin modulesJulien Gilli2015-03-031-0/+2
| | | | | | | | | | | This is a follow-up commit for b233131901dea47132b0748d8e4d6bfcbba28abe. 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>
* util: add es6 Symbol support for `util.inspect`gyson2014-10-031-0/+4
| | | | | | | | | * `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>
* util: made util.isArray a direct alias for Array.isArrayEvan Carroll2014-04-031-4/+1
|
* lib: use triple equalsYuki KAN2014-04-021-1/+1
| | | | Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* util: show meaningful values for boxed primitivesNathan Rajlich2014-02-061-0/+62
| | | | | | | | | | 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
* lib: Remove unused var+operations in util.inspectThom Seddon2014-01-291-3/+0
| | | | | | | 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
* tls_wrap: propagate errors to write callbacksFedor Indutny2014-01-241-2/+5
| | | | fix #6903
* util: handle escaped forward slashes correctlyTom Gallacher2014-01-101-1/+2
| | | | Fixes #6835
* Revert "util: more strict check for bool/number/string"Trevor Norris2013-12-201-3/+3
| | | | This reverts commit 95ee84fabe0b028ef964cc1032cd56a6cf89cb0e.
* util: more strict check for bool/number/stringYorkie2013-12-181-3/+3
|
* util: Format negative zero as '-0'David Chan2013-11-251-1/+6
| | | | | | | | | 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.
* util: format as Error if instanceof ErrorRod Vagg2013-10-151-1/+2
|
* util: pass opts to custom inspect functionsTimothy J Fontaine2013-08-221-1/+1
| | | | | | | | Objects with custom inpsect functions should get the options that were passed to `util.inspect()` fixes #5822 fixes #6098
* util: isObject should always return booleanTrevor Norris2013-08-201-1/+1
| | | | | Fix small bug where isObject would return the original object instead of true.
* util: fix isPrimitive checkTrevor Norris2013-08-121-1/+6
| | | | | Previous check failed for the edge case Object.create(null). This uses the current v8 code for the check.
* util: add isPrimitive checkTrevor Norris2013-08-021-0/+5
|
* src: Replace macros with util functionsisaacs2013-08-011-26/+81
|
* util: don't throw on circular %j input to format()Ben Noordhuis2013-07-291-1/+6
| | | | | | 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]'.
* lib: macro-ify type checksBen Noordhuis2013-07-241-37/+34
| | | | | Increases the grep factor. Makes it easier to harmonize type checks across the code base.
* util: removed duplicated isArray checkWyatt Preul2013-07-221-2/+1
|
* src, lib: deduplicate errnoExceptionBen Noordhuis2013-07-201-0/+12
|
* util: Add debuglog, deprecate console lookalikesisaacs2013-05-211-74/+93
|
* util: make util.log handle non strings like console.logNick Sullivan2013-05-131-2/+3
| | | | | | | 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.
* util: fix util.inspect() line width calculationMarcin Kostrzewa2013-03-281-1/+1
| | | | | | | | Have the formatter filter out vt100 color codes when calculating the line width. Stops it from unnecessarily splitting strings over multiple lines. Fixes #5039.
* util: custom `inspect()` method may return an ObjectNathan Rajlich2013-03-121-1/+5
| | | | | This is more like how `JSON.stringify()` works. Closes #2711.
* node: Add --throw-deprecationisaacs2013-03-061-1/+3
| | | | Extremely handy when tracking down a flood of recursive nextTick warnings.
* util: fix deprecation message in `util.pump`Ryunosuke SATO2012-12-261-1/+1
|
* lintisaacs2012-10-121-1/+2
|
* util: add a "customInspect" option to `util.inspect()`Nathan Rajlich2012-10-101-1/+2
| | | | | For disabling calling the custom `inspect()` function when defined on an object that is being inspected.
* util: make `inspect()` accept an "options" argumentNathan Rajlich2012-10-101-9/+20
| | | | | | | | 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.
* Merge remote-tracking branch 'ry/v0.8' into masterisaacs2012-09-121-2/+6
|\ | | | | | | | | | | | | Conflicts: ChangeLog src/node_version.h test/simple/test-util-inspect.js
| * util: make util.inspect() work when "hasOwnProperty" is overwrittenNathan Rajlich2012-09-081-2/+6
| |
* | util: mark util.pump() as deprecatedBen Noordhuis2012-08-051-2/+4
| |
* | Enable color customization of `util.inspect`Pavel Lang2012-07-161-5/+5
|/ | | | | | | | 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.
* Use unicode escape sequences instead of octalJonas Westerlund2012-07-061-2/+2
| | | | The latter is illegal in strict mode.
* util: speed up formatting of large arrays/objectsBen Noordhuis2012-06-281-3/+18
| | | | | | | 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.
* Add --no-deprecation and --trace-deprecation flagsisaacs2012-06-211-6/+29
|
* util: make _extend() more robustBen Noordhuis2012-05-101-1/+1
| | | | Add a better 'is object?' check, the old one let values like true slip through.
* util: handle non-string return value in .inspect()Alex Kocharin2012-05-091-1/+1
|
* util: fix util.format() formatting of %%ssuda2012-03-031-1/+1
|
* util: add `util._extend` for extending objectsMaciej Małecki2012-02-201-0/+12
| | | | | There were 2 duplicates with such functionality in `cluster` and `child_process` modules which were replaced by this function.
* util: fix typo in lib/util.jsLuke Gallagher2012-02-201-1/+1
|
* core: add `NativeModule.prototype.deprecate`Brandon Benvie2012-01-301-29/+2
| | | | Formalize and cleanup handling of deprecated core methods.
* Merge branch 'v0.6'Fedor Indutny2012-01-241-14/+13
|\ | | | | | | | | | | | | | | | | | | | | | | 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
| * util: use getOwnPropertyDescripterBrandon Benvie2012-01-221-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Revert "util: always display a warning for module in debug mode"Fedor Indutny2012-01-161-10/+9
| | | | | | | | This reverts commit df62005ece4bb0be0d5af645fd9093b1506ce63d.
* | util: always display a warning for module in debug modeMaciej Małecki2012-01-161-9/+10
| |
* | util: output Dates with Date.toString not Date.toUTCStringAvi Flax2011-12-181-1/+1
|/
* util: add internal function _deprecationWarning()Ben Noordhuis2011-12-141-0/+16
|
* util: ensure that the .inspect function isn't the one being executedNathan Rajlich2011-11-301-1/+1
| | | | Fixes #2225.