File size: 335 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { isNumber } from '@sniptt/guards';

export const isNonEmptyArray = <T>(
  probableArray: T[] | readonly T[] | undefined | null,
): probableArray is NonNullable<T[]> => {
  if (
    Array.isArray(probableArray) &&
    isNumber(probableArray.length) &&
    probableArray.length > 0
  ) {
    return true;
  }

  return false;
};