Check if an array is not empty
JavaScript version
const isNotEmpty = (arr) => Array.isArray(arr) && Object.keys(arr).length > 0;
TypeScript version
const isNotEmpty = (arr: any): boolean => Array.isArray(arr) && Object.keys(arr).length > 0;
Examples
isNotEmpty([]); // false
isNotEmpty([1, 2, 3]); // true