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

code refactoring #346

@yashgandhi-32

Description

@yashgandhi-32

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions