@ribajs/core
Version:
Core module of Riba.js
11 lines (10 loc) • 319 B
text/typescript
/**
* Returns the size of a string (the number of characters) or an array (the number of elements).
* @see https://help.shopify.com/themes/liquid/filters/array-filters#size
*/
export const sizeFormatter = {
name: "size",
read(value: any[] | string) {
return value && value.length ? value.length : 0;
},
};