diff options
author | Stanislav <62983943+stanislavstrelnikov@users.noreply.github.com> | 2020-07-07 04:45:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 21:45:39 -0400 |
commit | 158ae0bfe900d2bac3076390c4fe3d2b54d94fe5 (patch) | |
tree | 209e4b5682e2a899041767c49428e34329e48084 /cli/js/error_stack.ts | |
parent | ab4c574f5202f607ceb6068f56b3cc8aed1bbbaf (diff) |
clean up code in cli/js (#6611)
Diffstat (limited to 'cli/js/error_stack.ts')
-rw-r--r-- | cli/js/error_stack.ts | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/cli/js/error_stack.ts b/cli/js/error_stack.ts index 39561ad85..4c46675ca 100644 --- a/cli/js/error_stack.ts +++ b/cli/js/error_stack.ts @@ -1,4 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + // Some of the code here is adapted directly from V8 and licensed under a BSD // style license available here: https://github.com/v8/v8/blob/24886f2d1c565287d33d71e4109a53bf0b54b75c/LICENSE.v8 import * as colors from "./colors.ts"; @@ -94,10 +95,10 @@ function getMethodCall(callSite: CallSite): string { return result; } -function getFileLocation(callSite: CallSite, isInternal = false): string { - const cyan = isInternal ? colors.gray : colors.cyan; - const yellow = isInternal ? colors.gray : colors.yellow; - const black = isInternal ? colors.gray : (s: string): string => s; +function getFileLocation(callSite: CallSite, internal = false): string { + const cyan = internal ? colors.gray : colors.cyan; + const yellow = internal ? colors.gray : colors.yellow; + const black = internal ? colors.gray : (s: string): string => s; if (callSite.isNative()) { return cyan("native"); } @@ -130,9 +131,9 @@ function getFileLocation(callSite: CallSite, isInternal = false): string { return result; } -function callSiteToString(callSite: CallSite, isInternal = false): string { - const cyan = isInternal ? colors.gray : colors.cyan; - const black = isInternal ? colors.gray : (s: string): string => s; +function callSiteToString(callSite: CallSite, internal = false): string { + const cyan = internal ? colors.gray : colors.cyan; + const black = internal ? colors.gray : (s: string): string => s; let result = ""; const functionName = callSite.getFunctionName(); @@ -164,13 +165,11 @@ function callSiteToString(callSite: CallSite, isInternal = false): string { } else if (functionName) { result += colors.bold(colors.italic(black(functionName))); } else { - result += getFileLocation(callSite, isInternal); + result += getFileLocation(callSite, internal); return result; } - result += ` ${black("(")}${getFileLocation(callSite, isInternal)}${black( - ")" - )}`; + result += ` ${black("(")}${getFileLocation(callSite, internal)}${black(")")}`; return result; } |