| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1d54f07 commit 52a04bb
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,7 +144,7 @@ exports.debuglog = function(set) { | |||
| 144 | 144 | debugEnviron = process.env.NODE_DEBUG || ''; | |
| 145 | 145 | set = set.toUpperCase(); | |
| 146 | 146 | if (!debugs[set]) { | |
| 147 | - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { | ||
| 147 | + if (new RegExp(`\\b${set}\\b`, 'i').test(debugEnviron)) { | ||
| 148 | 148 | var pid = process.pid; | |
| 149 | 149 | debugs[set] = function() { | |
| 150 | 150 | var msg = exports.format.apply(exports, arguments); | |
@@ -239,8 +239,8 @@ function stylizeWithColor(str, styleType) { | |||
| 239 | 239 | var style = inspect.styles[styleType]; | |
| 240 | 240 | ||
| 241 | 241 | if (style) { | |
| 242 | - return '\u001b[' + inspect.colors[style][0] + 'm' + str + | ||
| 243 | - '\u001b[' + inspect.colors[style][1] + 'm'; | ||
| 242 | + return `\u001b[${inspect.colors[style][0]}m${str}` + | ||
| 243 | + `\u001b[${inspect.colors[style][1]}m`; | ||
| 244 | 244 | } else { | |
| 245 | 245 | return str; | |
| 246 | 246 | } | |
@@ -402,8 +402,8 @@ function formatValue(ctx, value, recurseTimes) { | |||
| 402 | 402 | // Some type of object without properties can be shortcutted. | |
| 403 | 403 | if (keys.length === 0) { | |
| 404 | 404 | if (typeof value === 'function') { | |
| 405 | - var name = value.name ? ': ' + value.name : ''; | ||
| 406 | - return ctx.stylize('[Function' + name + ']', 'special'); | ||
| 405 | + return ctx.stylize(`[Function${value.name ? `: ${value.name}` : ''}]`, | ||
| 406 | + 'special'); | ||
| 407 | 407 | } | |
| 408 | 408 | if (isRegExp(value)) { | |
| 409 | 409 | return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); | |
@@ -421,19 +421,19 @@ function formatValue(ctx, value, recurseTimes) { | |||
| 421 | 421 | // now check the `raw` value to handle boxed primitives | |
| 422 | 422 | if (typeof raw === 'string') { | |
| 423 | 423 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 424 | - return ctx.stylize('[String: ' + formatted + ']', 'string'); | ||
| 424 | + return ctx.stylize(`[String: ${formatted}]`, 'string'); | ||
| 425 | 425 | } | |
| 426 | 426 | if (typeof raw === 'symbol') { | |
| 427 | 427 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 428 | - return ctx.stylize('[Symbol: ' + formatted + ']', 'symbol'); | ||
| 428 | + return ctx.stylize(`[Symbol: ${formatted}]`, 'symbol'); | ||
| 429 | 429 | } | |
| 430 | 430 | if (typeof raw === 'number') { | |
| 431 | 431 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 432 | - return ctx.stylize('[Number: ' + formatted + ']', 'number'); | ||
| 432 | + return ctx.stylize(`[Number: ${formatted}]`, 'number'); | ||
| 433 | 433 | } | |
| 434 | 434 | if (typeof raw === 'boolean') { | |
| 435 | 435 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 436 | - return ctx.stylize('[Boolean: ' + formatted + ']', 'boolean'); | ||
| 436 | + return ctx.stylize(`[Boolean: ${formatted}]`, 'boolean'); | ||
| 437 | 437 | } | |
| 438 | 438 | // Fast path for ArrayBuffer and SharedArrayBuffer. | |
| 439 | 439 | // Can't do the same for DataView because it has a non-primitive | |
@@ -535,8 +535,7 @@ function formatValue(ctx, value, recurseTimes) { | |||
| 535 | 535 | ||
| 536 | 536 | // Make functions say that they are functions | |
| 537 | 537 | if (typeof value === 'function') { | |
| 538 | - var n = value.name ? ': ' + value.name : ''; | ||
| 539 | - base = ' [Function' + n + ']'; | ||
| 538 | + base = ` [Function${value.name ? `: ${value.name}` : ''}]`; | ||
| 540 | 539 | } | |
| 541 | 540 | ||
| 542 | 541 | // Make RegExps say that they are RegExps | |
@@ -557,24 +556,24 @@ function formatValue(ctx, value, recurseTimes) { | |||
| 557 | 556 | // Make boxed primitive Strings look like such | |
| 558 | 557 | if (typeof raw === 'string') { | |
| 559 | 558 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 560 | - base = ' ' + '[String: ' + formatted + ']'; | ||
| 559 | + base = ` [String: ${formatted}]`; | ||
| 561 | 560 | } | |
| 562 | 561 | ||
| 563 | 562 | // Make boxed primitive Numbers look like such | |
| 564 | 563 | if (typeof raw === 'number') { | |
| 565 | 564 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 566 | - base = ' ' + '[Number: ' + formatted + ']'; | ||
| 565 | + base = ` [Number: ${formatted}]`; | ||
| 567 | 566 | } | |
| 568 | 567 | ||
| 569 | 568 | // Make boxed primitive Booleans look like such | |
| 570 | 569 | if (typeof raw === 'boolean') { | |
| 571 | 570 | formatted = formatPrimitiveNoColor(ctx, raw); | |
| 572 | - base = ' ' + '[Boolean: ' + formatted + ']'; | ||
| 571 | + base = ` [Boolean: ${formatted}]`; | ||
| 573 | 572 | } | |
| 574 | 573 | ||
| 575 | 574 | // Add constructor name if available | |
| 576 | 575 | if (base === '' && constructor) | |
| 577 | - braces[0] = constructor.name + ' ' + braces[0]; | ||
| 576 | + braces[0] = `${constructor.name} ${braces[0]}`; | ||
| 578 | 577 | ||
| 579 | 578 | if (empty === true) { | |
| 580 | 579 | return braces[0] + base + braces[1]; | |
@@ -646,7 +645,7 @@ function formatPrimitiveNoColor(ctx, value) { | |||
| 646 | 645 | ||
| 647 | 646 | ||
| 648 | 647 | function formatError(value) { | |
| 649 | - return value.stack || '[' + Error.prototype.toString.call(value) + ']'; | ||
| 648 | + return value.stack || `[${Error.prototype.toString.call(value)}]`; | ||
| 650 | 649 | } | |
| 651 | 650 | ||
| 652 | 651 | ||
@@ -782,9 +781,9 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | |||
| 782 | 781 | } | |
| 783 | 782 | if (!hasOwnProperty(visibleKeys, key)) { | |
| 784 | 783 | if (typeof key === 'symbol') { | |
| 785 | - name = '[' + ctx.stylize(key.toString(), 'symbol') + ']'; | ||
| 784 | + name = `[${ctx.stylize(key.toString(), 'symbol')}]`; | ||
| 786 | 785 | } else { | |
| 787 | - name = '[' + key + ']'; | ||
| 786 | + name = `[${key}]`; | ||
| 788 | 787 | } | |
| 789 | 788 | } | |
| 790 | 789 | if (!str) { | |
@@ -822,7 +821,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | |||
| 822 | 821 | } | |
| 823 | 822 | } | |
| 824 | 823 | ||
| 825 | - return name + ': ' + str; | ||
| 824 | + return `${name}: ${str}`; | ||
| 826 | 825 | } | |
| 827 | 826 | ||
| 828 | 827 | ||
@@ -837,13 +836,10 @@ function reduceToSingleString(output, base, braces, breakLength) { | |||
| 837 | 836 | // we need to force the first item to be on the next line or the | |
| 838 | 837 | // items will not line up correctly. | |
| 839 | 838 | (base === '' && braces[0].length === 1 ? '' : base + '\n ') + | |
| 840 | - ' ' + | ||
| 841 | - output.join(',\n ') + | ||
| 842 | - ' ' + | ||
| 843 | - braces[1]; | ||
| 839 | + ` ${output.join(',\n ')} ${braces[1]}`; | ||
| 844 | 840 | } | |
| 845 | 841 | ||
| 846 | - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; | ||
| 842 | + return `${braces[0]}${base} ${output.join(', ')} ${braces[1]}`; | ||
| 847 | 843 | } | |
| 848 | 844 | ||
| 849 | 845 | ||
@@ -1007,7 +1003,7 @@ exports.puts = internalUtil.deprecate(function() { | |||
| 1007 | 1003 | ||
| 1008 | 1004 | ||
| 1009 | 1005 | exports.debug = internalUtil.deprecate(function(x) { | |
| 1010 | - process.stderr.write('DEBUG: ' + x + '\n'); | ||
| 1006 | + process.stderr.write(`DEBUG: ${x}\n`); | ||
| 1011 | 1007 | }, 'util.debug is deprecated. Use console.error instead.'); | |
| 1012 | 1008 | ||
| 1013 | 1009 | ||
@@ -1020,7 +1016,7 @@ exports.error = internalUtil.deprecate(function(x) { | |||
| 1020 | 1016 | ||
| 1021 | 1017 | exports._errnoException = function(err, syscall, original) { | |
| 1022 | 1018 | var errname = uv.errname(err); | |
| 1023 | - var message = syscall + ' ' + errname; | ||
| 1019 | + var message = `${syscall} ${errname}`; | ||
| 1024 | 1020 | if (original) | |
| 1025 | 1021 | message += ' ' + original; | |
| 1026 | 1022 | var e = new Error(message); | |
@@ -1038,13 +1034,13 @@ exports._exceptionWithHostPort = function(err, | |||
| 1038 | 1034 | additional) { | |
| 1039 | 1035 | var details; | |
| 1040 | 1036 | if (port && port > 0) { | |
| 1041 | - details = address + ':' + port; | ||
| 1037 | + details = `${address}:${port}`; | ||
| 1042 | 1038 | } else { | |
| 1043 | 1039 | details = address; | |
| 1044 | 1040 | } | |
| 1045 | 1041 | ||
| 1046 | 1042 | if (additional) { | |
| 1047 | - details += ' - Local (' + additional + ')'; | ||
| 1043 | + details += ` - Local (${additional})`; | ||
| 1048 | 1044 | } | |
| 1049 | 1045 | var ex = exports._errnoException(err, syscall, details); | |
| 1050 | 1046 | ex.address = address; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments