File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
'use strict' ;
6
6
7
+ const arrayIncludes = require ( 'array-includes' ) ;
8
+
7
9
const pragmaUtil = require ( '../util/pragma' ) ;
8
10
const jsxUtil = require ( '../util/jsx' ) ;
9
11
const docsUrl = require ( '../util/docsUrl' ) ;
@@ -47,8 +49,8 @@ function trimLikeReact(text) {
47
49
const leadingSpaces = / ^ \s * / . exec ( text ) [ 0 ] ;
48
50
const trailingSpaces = / \s * $ / . exec ( text ) [ 0 ] ;
49
51
50
- const start = leadingSpaces . includes ( '\n' ) ? leadingSpaces . length : 0 ;
51
- const end = trailingSpaces . includes ( '\n' ) ? text . length - trailingSpaces . length : text . length ;
52
+ const start = arrayIncludes ( leadingSpaces , '\n' ) ? leadingSpaces . length : 0 ;
53
+ const end = arrayIncludes ( trailingSpaces , '\n' ) ? text . length - trailingSpaces . length : text . length ;
52
54
53
55
return text . slice ( start , end ) ;
54
56
}
@@ -92,7 +94,7 @@ module.exports = {
92
94
function isPaddingSpaces ( node ) {
93
95
return isJSXText ( node ) &&
94
96
isOnlyWhitespace ( node . raw ) &&
95
- node . raw . includes ( '\n' ) ;
97
+ arrayIncludes ( node . raw , '\n' ) ;
96
98
}
97
99
98
100
/**
You can’t perform that action at this time.
0 commit comments