@kobalte/core
Version:
Unstyled components and primitives for building accessible web apps and design systems with SolidJS.
21 lines (19 loc) • 398 B
JSX
// src/primitives/create-collection/get-item-count.ts
var cache = /* @__PURE__ */ new WeakMap();
function getItemCount(collection) {
let count = cache.get(collection);
if (count != null) {
return count;
}
count = 0;
for (const item of collection) {
if (item.type === "item") {
count++;
}
}
cache.set(collection, count);
return count;
}
export {
getItemCount
};