can-symbol
Version:
Well known symbols used to detail how to operate on different objects
24 lines (17 loc) • 522 B
Markdown
Boolean} can-symbol/symbols/size can.size
can-symbol/symbols/shape
Return the number of items in the collection.
`@@can.size()`
The `@@@@can.size` symbol points to a function that returns the number of
items in the collection.
```js
const obj = {
[ canSymbol.for( "can.size" ) ]: function() {
return Object.keys( this ).length;
}
};
obj.foo = true;
obj.bar = true;
obj[ canSymbol.for( "can.size" ) ](); //-> 2
```
{Number} The number of items in the collection.
{