Skip to content

Commit 240afbd

Browse files
committed
Use array.equals
1 parent 7bf5773 commit 240afbd

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

extensions/markdown-language-features/src/features/previewConfig.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7+
import { equals } from '../util/arrays';
78

89
export class MarkdownPreviewConfiguration {
910
public static getForResource(resource: vscode.Uri) {
@@ -21,7 +22,7 @@ export class MarkdownPreviewConfiguration {
2122
public readonly lineHeight: number;
2223
public readonly fontSize: number;
2324
public readonly fontFamily: string | undefined;
24-
public readonly styles: string[];
25+
public readonly styles: readonly string[];
2526

2627
private constructor(resource: vscode.Uri) {
2728
const editorConfig = vscode.workspace.getConfiguration('editor', resource);
@@ -49,25 +50,15 @@ export class MarkdownPreviewConfiguration {
4950
}
5051

5152
public isEqualTo(otherConfig: MarkdownPreviewConfiguration) {
52-
for (let key in this) {
53+
for (const key in this) {
5354
if (this.hasOwnProperty(key) && key !== 'styles') {
5455
if (this[key] !== otherConfig[key]) {
5556
return false;
5657
}
5758
}
5859
}
5960

60-
// Check styles
61-
if (this.styles.length !== otherConfig.styles.length) {
62-
return false;
63-
}
64-
for (let i = 0; i < this.styles.length; ++i) {
65-
if (this.styles[i] !== otherConfig.styles[i]) {
66-
return false;
67-
}
68-
}
69-
70-
return true;
61+
return equals(this.styles, otherConfig.styles);
7162
}
7263

7364
[key: string]: any;

0 commit comments

Comments
 (0)