This repository was archived by the owner on Jun 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
code refactoring #346
Copy link
Copy link
Open
Description
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
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: '', | |
}; | |
}); |
Metadata
Metadata
Assignees
Labels
No labels