## count · function

Reactively counts the number of properties in an object.

**Signature:** `(proxied: TargetType) => ValueRef<number>`

**Parameters:**

- `proxied: TargetType` - The observable object to count. In case an `array`, `Map`, or `Set` is passed in, a `ref` to its `.length` or `.size` will be returned.

**Returns:** an observable object for which the `value` property reflects the number of properties in `proxied` with a value other than `undefined`, or the collection size for arrays, Maps, and Sets.

**Examples:**

```typescript
const $items = A.proxy({x: 3, y: 7} as any);
const $count = A.count($items);

// Create a DOM text node for the count:
A('div text=', $count);
// <div>2</div>

// Or we can use it in an `derive` function:
A(() => console.log("The count is now", $count.value));
// The count is now 2

// Adding/removing items will update the count
$items.z = 12;
// Asynchronously, after 0ms:
// <div>3</div>
// The count is now 3
```
