getRandomFloat,
getRandomInteger,
hasOwnProp,
+ isArraySorted,
isEmptyArray,
isEmptyObject,
isEmptyString,
expect(isEmptyObject(new WeakMap())).toBe(false);
expect(isEmptyObject(new WeakSet())).toBe(false);
});
+
+ it('Verify isArraySorted()', () => {
+ expect(
+ isArraySorted([], (a, b) => {
+ return a - b;
+ }),
+ ).toBe(true);
+ expect(
+ isArraySorted([1], (a, b) => {
+ return a - b;
+ }),
+ ).toBe(true);
+ expect(isArraySorted<number>([1, 2, 3, 4, 5], (a, b) => a - b)).toBe(true);
+ expect(isArraySorted<number>([1, 2, 3, 5, 4], (a, b) => a - b)).toBe(false);
+ });
});