Skip to content

Commit

Permalink
Simplifies hasValidReactChildren
Browse files Browse the repository at this point in the history
  • Loading branch information
VIKTORVAV99 committed Jul 15, 2024
1 parent a904e07 commit f97b826
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/TransWithoutContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ const getChildren = (node) => {
return node.props && node.props.i18nIsDynamicList ? getAsArray(children) : children;
};

const hasValidReactChildren = (children) => {
if (Object.prototype.toString.call(children) !== '[object Array]') return false;
return children.every((child) => isValidElement(child));
};
const hasValidReactChildren = (children) =>
Array.isArray(children) && children.every(isValidElement);

const getAsArray = (data) => (Array.isArray(data) ? data : [data]);

Expand Down

0 comments on commit f97b826

Please sign in to comment.