提交 240afbde 编写于 作者: M Matt Bierner

Use array.equals

上级 7bf5773e
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { equals } from '../util/arrays';
export class MarkdownPreviewConfiguration {
public static getForResource(resource: vscode.Uri) {
......@@ -21,7 +22,7 @@ export class MarkdownPreviewConfiguration {
public readonly lineHeight: number;
public readonly fontSize: number;
public readonly fontFamily: string | undefined;
public readonly styles: string[];
public readonly styles: readonly string[];
private constructor(resource: vscode.Uri) {
const editorConfig = vscode.workspace.getConfiguration('editor', resource);
......@@ -49,7 +50,7 @@ export class MarkdownPreviewConfiguration {
}
public isEqualTo(otherConfig: MarkdownPreviewConfiguration) {
for (let key in this) {
for (const key in this) {
if (this.hasOwnProperty(key) && key !== 'styles') {
if (this[key] !== otherConfig[key]) {
return false;
......@@ -57,17 +58,7 @@ export class MarkdownPreviewConfiguration {
}
}
// Check styles
if (this.styles.length !== otherConfig.styles.length) {
return false;
}
for (let i = 0; i < this.styles.length; ++i) {
if (this.styles[i] !== otherConfig.styles[i]) {
return false;
}
}
return true;
return equals(this.styles, otherConfig.styles);
}
[key: string]: any;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册