Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Error in appendString in mdxComponents/index.js #123

Open
btray77 opened this issue Aug 9, 2021 · 0 comments
Open

Potential Error in appendString in mdxComponents/index.js #123

btray77 opened this issue Aug 9, 2021 · 0 comments

Comments

@btray77
Copy link

btray77 commented Aug 9, 2021

const appendString = (children) => {
if (Array.isArray(children)) {
return children.reduce((acc, current) => {
if (typeof current === 'string') {
return acc.concat(current);
} else if (typeof current === 'object') {
return acc.concat(current.props.children);
} else {
return acc;
}
}, '');
} else {
return children + ''; // <-- Fix
}
};
It doesn't necessarily return a string type all the time, so have to force string.

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

No branches or pull requests

1 participant