File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,26 @@ const COMPONENT_TYPES = {
66}
77
88function generateReactImport ( componentType ) {
9- return `import React${ componentType !== 'stateless' ? `, { ${ COMPONENT_TYPES [ componentType ] } }` : '' } from 'react'`
9+ return `import React${
10+ componentType !== 'stateless' ? `, { ${ COMPONENT_TYPES [ componentType ] } }` : ''
11+ } from 'react'`
1012}
1113
14+ /**
15+ * Create the concatenation of methods string that will be injected into class and pure components
16+ * @param {Array } componentMethods
17+ * @return {String } methods
18+ */
1219function generateComponentMethods ( componentMethods ) {
1320 if ( componentMethods . length === 0 ) {
14- return null
21+ return ''
1522 }
16- let methods = ''
17- componentMethods . forEach ( ( method ) => {
18- methods += `\n\xa0\xa0\xa0\xa0${ method } (){}\n`
19- } )
20- return methods
23+
24+ return componentMethods . reduce ( ( acc , method ) => {
25+ const methods = `${ acc } \n\xa0\xa0\xa0\xa0${ method } (){}\n`
26+
27+ return methods
28+ } , '' )
2129}
2230
2331function generateImports (
You can’t perform that action at this time.
0 commit comments