Skip to content

Commit

Permalink
chore: rename guard to test
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Oct 21, 2020
1 parent 05d2c83 commit ee8c5ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/children.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Children, cloneElement } from 'react';

export const visit = (children, guard, fn, parent = null) => {
export const visit = (children, test, fn, parent = null) => {
Children.toArray(children).forEach((child, idx) => {
if (guard(child, idx, parent)) {
if (test(child, idx, parent)) {
fn(child, idx, parent);
} else if (child.props?.children) {
visit(child.props.children, guard, fn, child);
visit(child.props.children, test, fn, child);
}
});
};
Expand Down

0 comments on commit ee8c5ea

Please sign in to comment.