Files
NapCatQQ/.pnpm-store/v3/files/f2/c5640f678b97d379b6b0b2a15892e84aa8a9f0720810fddd526aedd56ba83e99dcf7e732cdac36fdaceb775d64a64dfac4e92a9296f0dc5d9ff256445d39f1
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

15 lines
436 B
Plaintext

import { Children, isValidElement } from 'react';
const getChildKey = (child) => child.key || "";
function onlyElements(children) {
const filtered = [];
// We use forEach here instead of map as map mutates the component key by preprending `.$`
Children.forEach(children, (child) => {
if (isValidElement(child))
filtered.push(child);
});
return filtered;
}
export { getChildKey, onlyElements };