Type guard: Array.isArray(x) && x.length > 0
npm install @thinice/is-non-empty-arrayType guard: Array.isArray(x) && x.length > 0
``bash`
npm install @thinice/is-non-empty-array
`typescript
import { isNonEmptyArray } from "@thinice/is-non-empty-array";
isNonEmptyArray([1, 2]); // true
isNonEmptyArray([]); // false
isNonEmptyArray("foo"); // false
if (isNonEmptyArray
value[0]; // number - guaranteed to exist
}
`
Note: Element types are NOT validated at runtime (same as is-array`).