@@ -127,7 +127,7 @@ exports.beautify = function(session) {
127127 }
128128
129129 // line break before }
130- if ( ! inTag && ! rowsToAdd && token . type === "paren.rparen" && token . value . substr ( 0 , 1 ) === "}" ) {
130+ if ( ! inTag && ! rowsToAdd && token . type == "paren.rparen" && token . value . substr ( 0 , 1 ) === "}" ) {
131131 rowsToAdd ++ ;
132132 }
133133
@@ -153,7 +153,7 @@ exports.beautify = function(session) {
153153
154154 if ( value ) {
155155 // whitespace
156- if ( token . type === "keyword" && value . match ( / ^ ( i f | e l s e | e l s e i f | f o r | f o r e a c h | w h i l e | s w i t c h ) $ / ) ) {
156+ if ( token . type == "keyword" && value . match ( / ^ ( i f | e l s e | e l s e i f | f o r | f o r e a c h | w h i l e | s w i t c h ) $ / ) ) {
157157 parents [ depth ] = value ;
158158
159159 trimNext ( ) ;
@@ -167,7 +167,7 @@ exports.beautify = function(session) {
167167 }
168168 }
169169 // trim value after opening paren
170- } else if ( token . type === "paren.lparen" ) {
170+ } else if ( token . type == "paren.lparen" ) {
171171 trimNext ( ) ;
172172
173173 // whitespace after {
@@ -194,7 +194,7 @@ exports.beautify = function(session) {
194194 }
195195 }
196196 // remove space before closing paren
197- } else if ( token . type === "paren.rparen" ) {
197+ } else if ( token . type == "paren.rparen" ) {
198198 unindent = 1 ;
199199
200200 // ensure curly brace is preceeded by whitespace
@@ -232,21 +232,21 @@ exports.beautify = function(session) {
232232
233233 trimLine ( ) ;
234234 // add spaces around conditional operators
235- } else if ( ( token . type === "keyword.operator" || token . type = == "keyword" ) && value . match ( / ^ ( = | = = | = = = | ! = | ! = = | & & | \| \| | a n d | o r | x o r | \+ = | .= | > | > = | < | < = | = > ) $ / ) ) {
235+ } else if ( ( token . type == "keyword.operator" || token . type == "keyword" ) && value . match ( / ^ ( = | = = | = = = | ! = | ! = = | & & | \| \| | a n d | o r | x o r | \+ = | .= | > | > = | < | < = | = > ) $ / ) ) {
236236 trimCode ( ) ;
237237 trimNext ( ) ;
238238 spaceBefore = true ;
239239 spaceAfter = true ;
240240 // remove space before semicolon
241- } else if ( token . type === "punctuation.operator" && value === ';' ) {
241+ } else if ( token . type == "punctuation.operator" && value === ';' ) {
242242 trimCode ( ) ;
243243 trimNext ( ) ;
244244 spaceAfter = true ;
245245
246246 if ( inCSS )
247247 rowsToAdd ++ ;
248248 // space after colon or comma
249- } else if ( token . type === "punctuation.operator" && value . match ( / ^ ( : | , ) $ / ) ) {
249+ } else if ( token . type == "punctuation.operator" && value . match ( / ^ ( : | , ) $ / ) ) {
250250 trimCode ( ) ;
251251 trimNext ( ) ;
252252
@@ -258,7 +258,7 @@ exports.beautify = function(session) {
258258 breakBefore = false ;
259259 }
260260 // ensure space before php closing tag
261- } else if ( token . type === "support.php_tag" && value === "?>" && ! breakBefore ) {
261+ } else if ( token . type == "support.php_tag" && value === "?>" && ! breakBefore ) {
262262 trimCode ( ) ;
263263 spaceBefore = true ;
264264 // remove excess space before HTML attribute
@@ -273,7 +273,7 @@ exports.beautify = function(session) {
273273 trimLine ( ) ;
274274 if ( value === "/>" )
275275 spaceBefore = true ;
276- } else if ( token . type === "keyword" && value . match ( / ^ ( c a s e | d e f a u l t ) $ / ) ) {
276+ } else if ( token . type == "keyword" && value . match ( / ^ ( c a s e | d e f a u l t ) $ / ) ) {
277277 if ( caseBody )
278278 unindent = 1 ;
279279 }
@@ -306,33 +306,33 @@ exports.beautify = function(session) {
306306 code += tabString ;
307307 }
308308
309- if ( token . type === "keyword" && value . match ( / ^ ( c a s e | d e f a u l t ) $ / ) ) {
309+ if ( token . type == "keyword" && value . match ( / ^ ( c a s e | d e f a u l t ) $ / ) ) {
310310 if ( caseBody === false ) {
311311 parents [ depth ] = value ;
312312 depth ++ ;
313313 caseBody = true ;
314314 }
315- } else if ( token . type === "keyword" && value . match ( / ^ ( b r e a k ) $ / ) ) {
315+ } else if ( token . type == "keyword" && value . match ( / ^ ( b r e a k ) $ / ) ) {
316316 if ( parents [ depth - 1 ] && parents [ depth - 1 ] . match ( / ^ ( c a s e | d e f a u l t ) $ / ) ) {
317317 depth -- ;
318318 caseBody = false ;
319319 }
320320 }
321321
322322 // indent one line after if or else
323- if ( token . type === "paren.lparen" ) {
323+ if ( token . type == "paren.lparen" ) {
324324 roundDepth += ( value . match ( / \( / g) || [ ] ) . length ;
325325 curlyDepth += ( value . match ( / \{ / g) || [ ] ) . length ;
326326 depth += value . length ;
327327 }
328328
329- if ( token . type === "keyword" && value . match ( / ^ ( i f | e l s e | e l s e i f | f o r | w h i l e ) $ / ) ) {
329+ if ( token . type == "keyword" && value . match ( / ^ ( i f | e l s e | e l s e i f | f o r | w h i l e ) $ / ) ) {
330330 indentNextLine = true ;
331331 roundDepth = 0 ;
332332 } else if ( ! roundDepth && value . trim ( ) && token . type !== "comment" )
333333 indentNextLine = false ;
334334
335- if ( token . type === "paren.rparen" ) {
335+ if ( token . type == "paren.rparen" ) {
336336 roundDepth -= ( value . match ( / \) / g) || [ ] ) . length ;
337337 curlyDepth -= ( value . match ( / \} / g) || [ ] ) . length ;
338338
0 commit comments