Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>2022-01-30 01:01:55 +0300
committerGitHub <noreply@github.com>2022-01-30 01:01:55 +0300
commit85eca3d2c75fc89034216e86c88f1f5fe2398172 (patch)
treef02fafb2f2faec474f4e39d024bd65d1e911062e /lib
parent05e9cb6f22930bf7332fc0dee6766b6578682c02 (diff)
lib: refactor source map stack trace prepare
• Make use of the logical OR operator (`||`) for better readability. • Remove unnecessary conditional and wrapping. PR-URL: https://github.com/nodejs/node/pull/41698 Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/source_map/prepare_stack_trace.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/internal/source_map/prepare_stack_trace.js b/lib/internal/source_map/prepare_stack_trace.js
index 9502cfef6fe..9492de22833 100644
--- a/lib/internal/source_map/prepare_stack_trace.js
+++ b/lib/internal/source_map/prepare_stack_trace.js
@@ -89,12 +89,12 @@ const prepareStackTrace = (globalThis, error, trace) => {
// Construct call site name based on: v8.dev/docs/stack-trace-api:
const fnName = t.getFunctionName() ?? t.getMethodName();
const originalName = `${t.getTypeName() !== 'global' ?
- `${t.getTypeName()}.` : ''}${fnName ? fnName : '<anonymous>'}`;
+ `${t.getTypeName()}.` : ''}${fnName || '<anonymous>'}`;
// The original call site may have a different symbol name
// associated with it, use it:
const prefix = (name && name !== originalName) ?
`${name}` :
- `${originalName ? originalName : ''}`;
+ `${originalName}`;
const hasName = !!(name || originalName);
const originalSourceNoScheme =
StringPrototypeStartsWith(originalSource, 'file://') ?
@@ -160,7 +160,7 @@ function getErrorSource(
let prefix = '';
for (const character of new SafeStringIterator(
StringPrototypeSlice(line, 0, originalColumn + 1))) {
- prefix += (character === '\t') ? '\t' :
+ prefix += character === '\t' ? '\t' :
StringPrototypeRepeat(' ', getStringWidth(character));
}
prefix = StringPrototypeSlice(prefix, 0, -1); // The last character is '^'.