Hy guys i was checking codebase, i find for some functions code readability is less like one of example below i think it can be resolved using IIFE , should i raise PR for refactoring ?
|
return folders[0] ? folders.map((folder) => { |
|
const examples = getExampleFiles(examplesPath, componentName, folder); |
|
return examples.map((file) => { |
|
const filePath = path.join(examplesPath, componentName, folder, file); |
|
const content = readFile(filePath); |
|
const info = parse(content); |
|
|
|
return { |
|
// By convention, component name should match the filename |
|
// So remove the .jsx extension to get the component name |
|
name: file.slice(0, -4), |
|
description: info.description, |
|
methods: info.methods, |
|
code: content, |
|
title: folder, |
|
}; |
|
}); |
|
}) : fileExamples.map((file) => { |
|
const filePath = path.join(examplesPath, componentName, file); |
|
const content = readFile(filePath); |
|
const info = parse(content); |
|
|
|
return { |
|
// By convention, component name should match the filename |
|
// So remove the .jsx extension to get the component name |
|
name: file.slice(0, -4), |
|
description: info.description, |
|
methods: info.methods, |
|
code: content, |
|
title: '', |
|
}; |
|
}); |
Hy guys i was checking codebase, i find for some functions code readability is less like one of example below i think it can be resolved using IIFE , should i raise PR for refactoring ?
ui/scripts/generateComponentData.js
Lines 86 to 117 in 1490ff7