Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

code refactoring #346

Open
yashgandhi-32 opened this issue Nov 30, 2021 · 0 comments
Open

code refactoring #346

yashgandhi-32 opened this issue Nov 30, 2021 · 0 comments

Comments

@yashgandhi-32
Copy link

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: '',
};
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant