Explorar el Código

Replaces !! with Boolean

main
Eric Amodio hace 6 años
padre
commit
53edd00dc5
Se han modificado 10 ficheros con 23 adiciones y 22 borrados
  1. +7
    -5
      src/git/gitService.ts
  2. +4
    -5
      src/git/parsers/logParser.ts
  3. +1
    -1
      src/git/parsers/stashParser.ts
  4. +1
    -1
      src/git/parsers/statusParser.ts
  5. +2
    -2
      src/keyboard.ts
  6. +1
    -1
      src/trackers/trackedDocument.ts
  7. +1
    -1
      src/ui/shared/app-base.ts
  8. +2
    -2
      src/views/nodes/branchNode.ts
  9. +1
    -1
      src/views/nodes/explorerNode.ts
  10. +3
    -3
      webpack.config.js

+ 7
- 5
src/git/gitService.ts Ver fichero

@ -1789,14 +1789,16 @@ export class GitService implements Disposable {
try {
// Even if we have a ref, check first to see if the file exists (that way the cache will be better reused)
let tracked = !!(await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName));
let tracked = Boolean(await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName));
if (!tracked && ref !== undefined) {
tracked = !!(await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, { ref: ref }));
tracked = Boolean(await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, { ref: ref }));
// If we still haven't found this file, make sure it wasn't deleted in that ref (i.e. check the previous)
if (!tracked) {
tracked = !!(await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, {
ref: `${ref}^`
}));
tracked = Boolean(
await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, {
ref: `${ref}^`
})
);
}
}
return tracked;

+ 4
- 5
src/git/parsers/logParser.ts Ver fichero

@ -181,10 +181,9 @@ export class GitLogParser {
}
if (entry.files !== undefined) {
entry.fileName = Arrays.filterMap(
entry.files,
f => (!!f.fileName ? f.fileName : undefined)
).join(', ');
entry.fileName = Arrays.filterMap(entry.files, f => (f.fileName ? f.fileName : undefined)).join(
', '
);
}
if (first && repoPath === undefined && type === GitCommitType.File && fileName !== undefined) {
@ -227,7 +226,7 @@ export class GitLogParser {
count: i,
maxCount: maxCount,
range: range,
truncated: !!(maxCount && i >= maxCount && maxCount !== 1)
truncated: Boolean(maxCount && i >= maxCount && maxCount !== 1)
} as GitLog;
}

+ 1
- 1
src/git/parsers/stashParser.ts Ver fichero

@ -111,7 +111,7 @@ export class GitStashParser {
if (entry.files !== undefined) {
entry.fileNames = Arrays.filterMap(
entry.files,
f => (!!f.fileName ? f.fileName : undefined)
f => (f.fileName ? f.fileName : undefined)
).join(', ');
}
}

+ 1
- 1
src/git/parsers/statusParser.ts Ver fichero

@ -9,7 +9,7 @@ export class GitStatusParser {
static parse(data: string, repoPath: string, porcelainVersion: number): GitStatus | undefined {
if (!data) return undefined;
const lines = data.split('\n').filter(l => !!l);
const lines = data.split('\n').filter(Boolean);
if (lines.length === 0) return undefined;
if (porcelainVersion < 2) return this.parseV1(lines, repoPath);

+ 2
- 2
src/keyboard.ts Ver fichero

@ -59,7 +59,7 @@ export class KeyboardScope implements Disposable {
const mapping = mappings[mappings.length - 1];
if (mapping !== this.mapping) return;
Logger.log('KeyboardScope.setKeyCommand', mappings.length, key, !!mapping[key]);
Logger.log('KeyboardScope.setKeyCommand', mappings.length, key, Boolean(mapping[key]));
if (!mapping[key]) {
mapping[key] = command;
@ -73,7 +73,7 @@ export class KeyboardScope implements Disposable {
private async updateKeyCommandsContext(mapping: KeyMapping) {
const promises = [];
for (const key of keys) {
promises.push(setCommandContext(`${CommandContext.Key}:${key}`, !!(mapping && mapping[key])));
promises.push(setCommandContext(`${CommandContext.Key}:${key}`, Boolean(mapping && mapping[key])));
}
await Promise.all(promises);
}

+ 1
- 1
src/trackers/trackedDocument.ts Ver fichero

@ -100,7 +100,7 @@ export class TrackedDocument implements Disposable {
}
get isRevision() {
return this._uri !== undefined ? !!this._uri.sha : false;
return this._uri !== undefined ? Boolean(this._uri.sha) : false;
}
private _isTracked: boolean = false;

+ 1
- 1
src/ui/shared/app-base.ts Ver fichero

@ -274,7 +274,7 @@ export abstract class App {
if (value === undefined) {
value = this.getSettingValue<string | boolean>(lhs) || false;
}
state = rhs !== undefined ? rhs === '' + value : !!value;
state = rhs !== undefined ? rhs === '' + value : Boolean(value);
break;
}
case '!': {

+ 2
- 2
src/views/nodes/branchNode.ts Ver fichero

@ -124,12 +124,12 @@ export class BranchNode extends ExplorerRefNode implements PageableExplorerNode
item.contextValue = ResourceType.RemoteBranch;
}
else if (this.current) {
item.contextValue = !!this.branch.tracking
item.contextValue = this.branch.tracking
? ResourceType.CurrentBranchWithTracking
: ResourceType.CurrentBranch;
}
else {
item.contextValue = !!this.branch.tracking ? ResourceType.BranchWithTracking : ResourceType.Branch;
item.contextValue = this.branch.tracking ? ResourceType.BranchWithTracking : ResourceType.Branch;
}
item.iconPath = {

+ 1
- 1
src/views/nodes/explorerNode.ts Ver fichero

@ -90,7 +90,7 @@ export interface PageableExplorerNode {
export function isPageable(
node: ExplorerNode
): node is ExplorerNode & { supportsPaging: boolean; maxCount: number | undefined } {
return !!(node as any).supportsPaging;
return Boolean((node as any).supportsPaging);
}
export function supportsAutoRefresh(

+ 3
- 3
webpack.config.js Ver fichero

@ -14,9 +14,9 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = function(env, argv) {
env = env || {};
env.production = !!env.production;
env.optimizeImages = env.production || !!env.optimizeImages;
env.copyClipboardyFallbacks = env.production || !!env.copyClipboardyFallbacks;
env.production = Boolean(env.production);
env.optimizeImages = env.production || Boolean(env.optimizeImages);
env.copyClipboardyFallbacks = env.production || Boolean(env.copyClipboardyFallbacks);
if (!env.copyClipboardyFallbacks && !fs.existsSync(path.resolve(__dirname, 'fallbacks'))) {
env.copyClipboardyFallbacks = true;

Cargando…
Cancelar
Guardar