UNPKG

@fe6/water-pro

Version:

An enterprise-class UI design language and Vue-based implementation

21 lines (19 loc) 595 B
import { isFragment } from '../../_util/props-util'; export default function toArray(children) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var ret = []; children.forEach(function (child) { if ((child === undefined || child === null) && !option.keepEmpty) { return; } debugger; if (Array.isArray(child)) { ret = ret.concat(toArray(child)); } else if (isFragment(child) && child.props) { ret = ret.concat(toArray(child.props.children, option)); } else { ret.push(child); } }); return ret; }