@@ -658,7 +658,7 @@ function encodeDefaultValue(val, isFunction) {
658658
659659 const arrowMatch = fn . match ( functionRE )
660660 if ( arrowMatch !== null ) {
661- return fn . substring ( arrowMatch [ 1 ] . length )
661+ return fn . slice ( arrowMatch [ 1 ] . length )
662662 }
663663 }
664664
@@ -737,11 +737,11 @@ function extractRuntimePropAttrs(runtimeProp) {
737737 runtimeTypes . push ( capitalize ( match [ 1 ] ) )
738738 }
739739
740- if ( fn . indexOf ( 'Array.isArray' ) !== - 1 ) {
740+ if ( fn . includes ( 'Array.isArray' ) ) {
741741 runtimeTypes . push ( 'Array' )
742742 }
743743
744- if ( fn . indexOf ( 'Object' ) !== - 1 ) {
744+ if ( fn . includes ( 'Object' ) ) {
745745 runtimeTypes . push ( 'Object' )
746746 }
747747
@@ -1073,7 +1073,7 @@ function parseObject({
10731073 )
10741074 }
10751075
1076- if ( itemName . indexOf ( 'class' ) !== - 1 ) {
1076+ if ( itemName . includes ( 'class' ) ) {
10771077 if ( obj . type === 'Object' && obj . tsType !== 'VueClassObjectProp' ) {
10781078 printErrorAndExit (
10791079 'object is class-type (Object form) but "tsType" prop is set to ' +
@@ -1088,7 +1088,7 @@ function parseObject({
10881088 `is set to "${ obj . tsType } " instead of "VueClassProp":`
10891089 )
10901090 }
1091- } else if ( itemName . indexOf ( 'style' ) !== - 1 ) {
1091+ } else if ( itemName . includes ( 'style' ) ) {
10921092 if ( obj . type === 'Object' && obj . tsType !== 'VueStyleObjectProp' ) {
10931093 printErrorAndExit (
10941094 'object is style-type (Object form) but "tsType" prop is ' +
@@ -1206,7 +1206,7 @@ function parseAPI(file, apiType) {
12061206 }
12071207 handledTypes . push ( 'value' , 'arg' )
12081208
1209- const isComponent = banner . indexOf ( 'component' ) !== - 1
1209+ const isComponent = banner . includes ( 'component' )
12101210
12111211 for ( const type in api ) {
12121212 const targetApi = api [ type ]
@@ -1249,7 +1249,7 @@ function fillAPI(apiType, list, encodeFn) {
12491249
12501250 const componentPath = file . replace ( '.json' , '.js' )
12511251 const componentName = name . replace ( '.json' , '.js' )
1252- const componentContent = fse . readFileSync ( componentPath , 'utf-8 ' )
1252+ const componentContent = fse . readFileSync ( componentPath , 'utf8 ' )
12531253
12541254 let RuntimeComponent
12551255
@@ -1316,7 +1316,7 @@ function fillAPI(apiType, list, encodeFn) {
13161316 const apiPropName = kebabCase ( runtimePropName )
13171317 const apiEntry = apiProps [ apiPropName ]
13181318
1319- if ( runtimePropName . indexOf ( '-' ) !== - 1 ) {
1319+ if ( runtimePropName . includes ( '-' ) ) {
13201320 logError (
13211321 `${ componentName } : prop "${ runtimePropName } " should be ` +
13221322 'in camelCase (found kebab-case)'
@@ -1439,7 +1439,7 @@ function fillAPI(apiType, list, encodeFn) {
14391439 if ( isRuntimeFunction === true ) {
14401440 const fn = runtimeDefaultValue . toString ( )
14411441
1442- if ( fn . indexOf ( '\n' ) !== - 1 ) {
1442+ if ( fn . includes ( '\n' ) ) {
14431443 logError (
14441444 `${ componentName } : prop "${ runtimePropName } " -> "default" ` +
14451445 'should be a single line arrow function (found multiple lines)'
@@ -1555,7 +1555,7 @@ function fillAPI(apiType, list, encodeFn) {
15551555 hasError = true
15561556 }
15571557
1558- if ( runtimeEmitName . indexOf ( '-' ) !== - 1 ) {
1558+ if ( runtimeEmitName . includes ( '-' ) ) {
15591559 logError (
15601560 `${ componentName } : "emits" -> "${ runtimeEmitName } " should be` +
15611561 ' in camelCase (found kebab-case)'
@@ -1651,7 +1651,7 @@ function fillAPI(apiType, list, encodeFn) {
16511651 // copy API file to dest
16521652 writeFile ( filePath , encodeFn ( api ) )
16531653
1654- const shortName = name . substring ( 0 , name . length - 5 )
1654+ const shortName = name . slice ( 0 , - 5 )
16551655 list . push ( shortName )
16561656
16571657 return {
@@ -1680,7 +1680,7 @@ function writeTransformAssetUrls(components, encodeFn) {
16801680 propName => api . props [ propName ] . transformAssetUrls === true
16811681 )
16821682
1683- if ( props . length > 0 ) {
1683+ if ( props . length !== 0 ) {
16841684 props = props . length > 1 ? props : props [ 0 ]
16851685
16861686 transformAssetUrls . tags [ name ] = props
0 commit comments