ts-data-forge
    Preparing search index...
    • Type guard that checks if an array is non-empty.

      Type Parameters

      • E

      Parameters

      • array: readonly E[]

      Returns array is readonly [E, E]

      const users: readonly { id: number }[] = [{ id: 1 }];
      const emptyUsers: readonly { id: number }[] = [];

      assert.ok(Arr.isNonEmpty(users));
      assert.notOk(Arr.isNonEmpty(emptyUsers));

      if (Arr.isNonEmpty(users)) {
      assert.deepStrictEqual(users[0], { id: 1 });
      }