Sha256: 9e4610894492e9a0f16919f332eb360912c494e71cef1224dd213803be0ba144
Contents?: true
Size: 554 Bytes
Versions: 69
Compression:
Stored size: 554 Bytes
Contents
import { toChildArray } from 'preact'; const mapFn = (children, fn) => { if (children == null) return null; return toChildArray(toChildArray(children).map(fn)); }; // This API is completely unnecessary for Preact, so it's basically passthrough. export const Children = { map: mapFn, forEach: mapFn, count(children) { return children ? toChildArray(children).length : 0; }, only(children) { const normalized = toChildArray(children); if (normalized.length !== 1) throw 'Children.only'; return normalized[0]; }, toArray: toChildArray };
Version data entries
69 entries across 69 versions & 1 rubygems