@kobalte/core
Version:
Unstyled components and primitives for building accessible web apps and design systems with SolidJS.
19 lines (17 loc) • 396 B
JavaScript
// 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 };