Skip to content

Commit 82502d2

Browse files
committed
fix [DEP0044] DeprecationWarning
1 parent e6554d5 commit 82502d2

4 files changed

Lines changed: 9 additions & 13 deletions

File tree

src/EIDEProjectExplorer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ import {
131131
SourceFileConfigurationItem, WorkspaceBrowseConfiguration
132132
} from 'vscode-cpptools';
133133
import * as eclipseParser from './EclipseProjectParser';
134-
import { isArray } from 'util';
135134
import {
136135
parseIarCompilerLog,
137136
CompilerDiagnostics, parseGccCompilerLog, parseArmccCompilerLog,
@@ -2160,7 +2159,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
21602159
// copy string options
21612160

21622161
const optToString = (obj: string | string[]): string => {
2163-
if (isArray(obj)) {
2162+
if (Array.isArray(obj)) {
21642163
return obj[0];
21652164
} else {
21662165
return obj;

src/EclipseProjectParser.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as os from 'os';
44
import * as xml2js from 'xml2js';
55
import { VirtualFolder } from './EIDETypeDefine';
66
import { VirtualSource, AbstractProject } from './EIDEProject';
7-
import { isArray } from 'util';
87
import { ArrayDelRepetition } from '../lib/node-utility/Utility';
98
import { File } from '../lib/node-utility/File';
109
import { GlobalEvent } from './GlobalEvents';
@@ -483,7 +482,7 @@ export async function parseEclipseProject(cprojectPath: string): Promise<Eclipse
483482

484483
for (const key in target.builldArgs) {
485484
const obj: any = target.builldArgs;
486-
if (isArray(obj[key])) {
485+
if (Array.isArray(obj[key])) {
487486
obj[key] = ArrayDelRepetition(obj[key]);
488487
}
489488
}
@@ -508,10 +507,10 @@ function parseToolOption(optionObj: any, prjtype: EclipseProjectType): { type: s
508507

509508
const makeResult = (value: string | string[], typ?: string): { type: string, val: string[] } | undefined => {
510509
if (value == '') return undefined;
511-
if (isArray(value) && value.length == 0) return undefined;
510+
if (Array.isArray(value) && value.length == 0) return undefined;
512511
return {
513512
type: typ || VALUE_TYPE || '',
514-
val: isArray(value) ? value : [value]
513+
val: Array.isArray(value) ? value : [value]
515514
};
516515
};
517516

@@ -792,7 +791,7 @@ function parseToolOption(optionObj: any, prjtype: EclipseProjectType): { type: s
792791

793792
function toArray(obj: any): any[] {
794793
if (obj == undefined || obj == null) return [];
795-
if (!isArray(obj)) return [obj];
794+
if (!Array.isArray(obj)) return [obj];
796795
return obj;
797796
}
798797

src/IarProjectParser.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as xml2js from 'xml2js';
55
import * as ini from 'ini';
66
import { VirtualFolder } from './EIDETypeDefine';
77
import { VirtualSource, AbstractProject } from './EIDEProject';
8-
import { isArray } from 'util';
98
import { ArrayDelRepetition } from '../lib/node-utility/Utility';
109
import { File } from '../lib/node-utility/File';
1110
import { GlobalEvent } from './GlobalEvents';
@@ -223,11 +222,11 @@ function parseTarget(proj: IarProjectInfo, configNodes: any) {
223222
});
224223
// builder action
225224
if (settingName == 'BUILDACTION') {
226-
if (isArray(dataNode.prebuild)) {
225+
if (Array.isArray(dataNode.prebuild)) {
227226
nTarget.builderActions.prebuild =
228227
formatEnvNameAndPathSep(dataNode.prebuild[0], true);
229228
}
230-
if (isArray(dataNode.postbuild)) {
229+
if (Array.isArray(dataNode.postbuild)) {
231230
nTarget.builderActions.postbuild =
232231
formatEnvNameAndPathSep(dataNode.postbuild[0], true);
233232
}
@@ -314,7 +313,7 @@ function isValidEnvName(name: string): boolean {
314313

315314
function toArray(obj: any): any[] {
316315
if (obj == undefined || obj == null) return [];
317-
if (isArray(obj)) return obj;
316+
if (Array.isArray(obj)) return obj;
318317
return [obj];
319318
}
320319

src/utility.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { GitFileInfo } from './WebInterface/GithubInterface';
3838
import * as platform from './Platform';
3939
import { SevenZipper } from './Compress';
4040
import { ResManager } from './ResManager';
41-
import { isArray } from 'util';
4241
import { ExeCmd } from '../lib/node-utility/Executable';
4342
import { GlobalEvent } from './GlobalEvents';
4443
import { SettingManager } from './SettingManager';
@@ -669,7 +668,7 @@ export function newFileTooltipString(f: File | FileTooltipInfo, root?: File): vs
669668

670669
export function toArray(obj: any): any[] {
671670
if (obj == undefined || obj == null) return [];
672-
if (isArray(obj)) return obj;
671+
if (Array.isArray(obj)) return obj;
673672
return [obj];
674673
}
675674

0 commit comments

Comments
 (0)