44 *--------------------------------------------------------------------------------------------*/
55
66import * as vscode from 'vscode' ;
7+ import { equals } from '../util/arrays' ;
78
89export 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