Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed Sep 19, 2023
1 parent f65c6ef commit 1fdee16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const max = Math.max;
export const abs = Math.abs;
export const now = Date.now;
export const values = Object.values;
export const isArray = Array.isArray;
export const timeout = setTimeout;

export const clamp = (
Expand Down
4 changes: 2 additions & 2 deletions src/react/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactElement, ReactFragment, ReactNode } from "react";
import { exists } from "../core/utils";
import { exists, isArray } from "../core/utils";

export const refKey = "current";

Expand All @@ -8,7 +8,7 @@ export const emptyComponents = {};
type ItemElement = ReactElement | ReactFragment | string | number;

const forEach = (children: ReactNode, elements: ItemElement[]) => {
if (Array.isArray(children)) {
if (isArray(children)) {
for (const c of children) {
forEach(c, elements);
}
Expand Down

0 comments on commit 1fdee16

Please sign in to comment.