Repository: marpple/FxTS (ts)

Issue:
Add `sort` function
# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## ⭐ Suggestion

<!-- What would you like to be added? -->

Same logic as the `Array.prototype.sort` function, but accepts`Iterable` and `AsyncIterable` as arguments.

## 💻 Use Cases

<!-- What do you want to use this for? -->

```ts
const iter = [1, 2, 3, 4, 5].revers()[Symbol.iterator]();
const asyncIter = toAsync([1, 2, 3, 4, 5].revers()[Symbol.iterator]());

sort((a, b) => a - b, iter); // [1, 2, 3, 4, 5]
await sort((a, b) => a - b, asyncIter); // [1, 2, 3, 4, 5]
```


Pull request description:
feat: add 'sort' function
Fixes #52 


Patch:
diff --git a/src/every.ts b/src/every.ts
index 544151a5..fa9e381e 100644
--- a/src/every.ts
+++ b/src/every.ts
@@ -23,7 +23,7 @@ import Arrow from "./types/Arrow";
  * {@link https://codesandbox.io/s/fxts-every-g91dh | Try It}
  */
 
-function every<A extends readonly []>(f: Arrow, iterable: A): true;
+function every<A extends readonly []>(f: Arrow, iterable: A): false;
 
 // prettier-ignore
 function every<A, B = unknown>(
@@ -59,7 +59,6 @@ function every<
       map(f, iterable as Iterable<IterableInfer<A>>),
       takeUntil(not),
       reduce((a, b) => a && b),
-      (a) => a ?? true,
       Boolean,
     );
   }
@@ -69,7 +68,6 @@ function every<
       map(f, iterable as AsyncIterable<IterableInfer<A>>),
       takeUntil(not),
       reduce((a, b) => a && b),
-      (a) => a ?? true,
       Boolean,
     );
   }
diff --git a/src/index.ts b/src/index.ts
index afccfc07..be8e5a60 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -12,21 +12,19 @@ import includes from "./includes";
 import indexBy from "./indexBy";
 import isArray from "./isArray";
 import isNil from "./isNil";
-import isObject from "./isObject";
 import isString from "./isString";
 import join from "./join";
 import last from "./last";
 import not from "./not";
 import nth from "./nth";
 import omit from "./omit";
-import omitBy from "./omitBy";
 import partition from "./partition";
 import pick from "./pick";
-import pickBy from "./pickBy";
 import pipe from "./pipe";
 import pipe1 from "./pipe1";
 import reduce from "./reduce";
 import some from "./some";
+import sort from "./sort";
 import tap from "./tap";
 import toArray from "./toArray";
 
@@ -47,21 +45,19 @@ export {
   indexBy,
   isArray,
   isNil,
-  isObject,
   isString,
   join,
   last,
   not,
   nth,
   omit,
-  omitBy,
   partition,
   pick,
-  pickBy,
   pipe,
   pipe1,
   reduce,
   some,
+  sort,
   tap,
   toArray,
 };
diff --git a/src/isObject.ts b/src/isObject.ts
deleted file mode 100644
index 3c63e861..00000000
--- a/src/isObject.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Checks if value is the type of object.
- *
- * @example
- * ```ts
- * isObject({}); // true
- * isObject([1, 2, 3]); // true
- * isObject(() => {}); // true
- * isObject(null); // false
- * isObject(123); // false
- * ```
- */
-
-type IdentityObject<T> = T extends object ? T : never;
-
-function isObject<T = unknown>(a: T): a is IdentityObject<T> {
-  const type = typeof a;
-  return a != null && (type === "object" || type === "function");
-}
-
-export default isObject;
diff --git a/src/omitBy.ts b/src/omitBy.ts
deleted file mode 100644
index d43dd48b..00000000
--- a/src/omitBy.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import {
-  AsyncEntryPredicate,
-  ConditionalAsyncEntryPredicate,
-  EntryPredicate,
-} from "./types/EntryPredicate";
-import toArray from "./toArray";
-import reject from "./Lazy/reject";
-import toAsync from "./Lazy/toAsync";
-import pipe from "./pipe";
-import { map, zip } from "./Lazy";
-
-/**
- *
- * Returns a partial copy of an object containing only the keys that satisfy the supplied predicate.
- *
- * @example
- * ```ts
- * const obj = { a: 1, b: "2", c: true };
- * omitBy(([key, value]) => key === "a" || value === true, obj); // { b: "2" }
- *
- * // asynchronous predicate
- * await omitBy(async ([key, value]) => key === "a" || value === true, obj); // { b: "2" }
- *
- * // Using with the `pipe` function
- * pipe(
- *   obj,
- *   omitBy(([key, value]) => key === "a" || value === true)
- * );
- *
- * await pipe(
- *   obj,
- *   omitBy(async ([key, value]) => key === "a" || value === true)
- * );
- * ```
- * see {@link https://fxts.dev/docs/pipe | pipe}, {@link https://fxts.dev/docs/omit | omit},
- */
-
-function omitBy<T extends object, F extends AsyncEntryPredicate<T>>(
-  f: F,
-  obj: T,
-): Promise<Partial<T>>;
-
-function omitBy<T extends object, F extends AsyncEntryPredicate<T>>(
-  f: F,
-): (obj: T) => Promise<Partial<T>>;
-
-function omitBy<T extends object, F extends EntryPredicate<T>>(
-  f: F,
-  obj: T,
-): Partial<T>;
-
-function omitBy<T extends object, F extends EntryPredicate<T>>(
-  f: F,
-): (obj: T) => Partial<T>;
-
-function omitBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(
-  f: F,
-  obj: T,
-): Partial<T> | Promise<Partial<T>>;
-
-function omitBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(
-  f: F,
-): (obj: T) => Partial<T> | Promise<Partial<T>>;
-
-function omitBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(
-  f: F,
-  obj?: T,
-):
-  | Partial<T>
-  | Promise<Partial<T>>
-  | ((obj: T) => Partial<T>)
-  | ((obj: T) => Promise<Partial<T>>)
-  | ((obj: T) => Partial<T> | Promise<Partial<T>>) {
-  if (obj === undefined) {
-    return (obj: T) => omitBy(f, obj);
-  }
-
-  const entries = Object.entries(obj);
-  const conditions = entries.map((entry) => f(entry as any));
-  const isAsync = conditions.some((c) => c instanceof Promise);
-
-  if (isAsync) {
-    return pipe(
-      entries,
-      zip(toAsync(conditions)),
-      reject(([cond]) => cond),
-      map(([, entry]) => entry),
-      toArray,
-      Object.fromEntries,
-    ) as Promise<Partial<T>>;
-  } else {
-    return pipe(
-      entries,
-      zip(conditions),
-      reject(([cond]) => cond),
-      map(([, entry]) => entry),
-      Object.fromEntries,
-    ) as Partial<T>;
-  }
-}
-
-export default omitBy;
diff --git a/src/pickBy.ts b/src/pickBy.ts
deleted file mode 100644
index a43d09fa..00000000
--- a/src/pickBy.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import {
-  AsyncEntryPredicate,
-  ConditionalAsyncEntryPredicate,
-  EntryPredicate,
-} from "./types/EntryPredicate";
-import toArray from "./toArray";
-import filter from "./Lazy/filter";
-import toAsync from "./Lazy/toAsync";
-import pipe from "./pipe";
-import { map, zip } from "./Lazy";
-
-/**
- *
- * Returns a partial copy of an object containing only the keys that satisfy the supplied predicate.
- *
- * @example
- * ```ts
- * const obj = { a: 1, b: "2", c: true };
- * pickBy(([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }
- *
- * // asynchronous predicate
- * await pickBy(async ([key, value]) => key === "a" || value === true, obj); // { a: 1, c: true }
- *
- * // Using with the `pipe` function
- * pipe(
- *   obj,
- *   pickBy(([key, value]) => key === "a" || value === true)
- * );
- *
- * await pipe(
- *   obj,
- *   pickBy(async ([key, value]) => key === "a" || value === true)
- * );
- * ```
- * see {@link https://fxts.dev/docs/pipe | pipe}, {@link https://fxts.dev/docs/pick | pick},
- */
-
-function pickBy<T extends object, F extends AsyncEntryPredicate<T>>(
-  f: F,
-  obj: T,
-): Promise<Partial<T>>;
-
-function pickBy<T extends object, F extends AsyncEntryPredicate<T>>(
-  f: F,
-): (obj: T) => Promise<Partial<T>>;
-
-function pickBy<T extends object, F extends EntryPredicate<T>>(
-  f: F,
-  obj: T,
-): Partial<T>;
-
-function pickBy<T extends object, F extends EntryPredicate<T>>(
-  f: F,
-): (obj: T) => Partial<T>;
-
-function pickBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(
-  f: F,
-  obj: T,
-): Partial<T> | Promise<Partial<T>>;
-
-function pickBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(
-  f: F,
-): (obj: T) => Partial<T> | Promise<Partial<T>>;
-
-function pickBy<T extends object, F extends ConditionalAsyncEntryPredicate<T>>(
-  f: F,
-  obj?: T,
-):
-  | Partial<T>
-  | Promise<Partial<T>>
-  | ((obj: T) => Partial<T>)
-  | ((obj: T) => Promise<Partial<T>>)
-  | ((obj: T) => Partial<T> | Promise<Partial<T>>) {
-  if (obj === undefined) {
-    return (obj: T) => pickBy(f, obj);
-  }
-
-  const entries = Object.entries(obj);
-  const conditions = entries.map((entry) => f(entry as any));
-  const isAsync = conditions.some((c) => c instanceof Promise);
-
-  if (isAsync) {
-    return pipe(
-      entries,
-      zip(toAsync(conditions)),
-      filter(([cond]) => cond),
-      map(([, entry]) => entry),
-      toArray,
-      Object.fromEntries,
-    ) as Promise<Partial<T>>;
-  } else {
-    return pipe(
-      entries,
-      zip(conditions),
-      filter(([cond]) => cond),
-      map(([, entry]) => entry),
-      Object.fromEntries,
-    ) as Partial<T>;
-  }
-}
-
-export default pickBy;
diff --git a/src/sort.ts b/src/sort.ts
new file mode 100644
index 00000000..0fbc03ec
--- /dev/null
+++ b/src/sort.ts
@@ -0,0 +1,68 @@
+import { isArray, pipe1, toArray } from ".";
+import IterableInfer from "./types/IterableInfer";
+import ReturnValueType from "./types/ReturnValueType";
+import { isAsyncIterable, isIterable } from "./_internal/utils";
+
+/**
+ * Returns an array which sorted according to the `f`
+ *
+ * @example
+ * ```ts
+ * sort((a, b) => a > b, [3, 4, 1, 2, 5, 2]); // [1, 2, 2, 3, 4, 5]
+ * sort((a, b) => a > b, 'bcdaef); // ["a", "b", "c", "d", "e", "f"]
+ * ```
+ */
+// prettier-ignore
+function sort(
+    f: (a: any, b: any) => unknown, 
+    iterable: readonly []
+  ): any[];
+
+// prettier-ignore
+function sort<T>(
+  f: (a: T, b: T) => unknown, 
+  iterable: Iterable<T>
+): T[];
+
+function sort<T>(
+  f: (a: T, b: T) => unknown,
+  iterable: AsyncIterable<T>,
+): Promise<T[]>;
+
+function sort<T extends Iterable<unknown> | AsyncIterable<unknown>>(
+  f: (a: IterableInfer<T>, b: IterableInfer<T>) => unknown,
+): (iterable: T) => ReturnValueType<T, IterableInfer<T>[]>;
+
+function sort<T extends Iterable<unknown> | AsyncIterable<unknown>>(
+  f: (a: T, b: T) => unknown,
+  iterable?: T,
+):
+  | IterableInfer<T>[]
+  | Promise<IterableInfer<T>[]>
+  | ((iterable: T) => ReturnValueType<T, IterableInfer<T>[]>) {
+  if (iterable === undefined) {
+    return (iterable: T) => {
+      return sort(f, iterable as any) as ReturnValueType<T, IterableInfer<T>[]>;
+    };
+  }
+
+  if (isArray(iterable)) {
+    return iterable.sort(f as any);
+  }
+
+  if (isIterable(iterable)) {
+    return pipe1(toArray(iterable as Iterable<IterableInfer<T>>), (arr) =>
+      arr.sort(f as any),
+    );
+  }
+
+  if (isAsyncIterable(iterable)) {
+    return pipe1(toArray(iterable as AsyncIterable<IterableInfer<T>>), (arr) =>
+      arr.sort(f as any),
+    );
+  }
+
+  throw new TypeError("'iterable' must be type of Iterable or AsyncIterable");
+}
+
+export default sort;
diff --git a/src/types/EntryPredicate.ts b/src/types/EntryPredicate.ts
deleted file mode 100644
index b57a2d40..00000000
--- a/src/types/EntryPredicate.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-export type AsyncEntryPredicate<T extends object> = ([key, value]: [
-  keyof T,
-  T[keyof T],
-]) => Promise<boolean>;
-
-export type ConditionalAsyncEntryPredicate<T extends object> = ([key, value]: [
-  keyof T,
-  T[keyof T],
-]) => boolean | Promise<boolean>;
-
-export type EntryPredicate<T extends object> = ([key, value]: [
-  keyof T,
-  T[keyof T],
-]) => boolean;


Test patch:
diff --git a/test/Lazy/concurrent.spec.ts b/test/Lazy/concurrent.spec.ts
index 8e03eac0..7660a715 100644
--- a/test/Lazy/concurrent.spec.ts
+++ b/test/Lazy/concurrent.spec.ts
@@ -1,13 +1,4 @@
-import {
-  concurrent,
-  delay,
-  filter,
-  map,
-  peek,
-  pipe,
-  range,
-  toAsync,
-} from "../../src/index";
+import { concurrent, delay, map, pipe, range, toAsync } from "../../src/index";
 import { callFuncAfterTime } from "../utils";
 
 describe("concurrent", function () {
@@ -60,47 +51,6 @@ describe("concurrent", function () {
     expect(arr).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
   }, 550);
 
-  it("should be affected only one concurrent below it, when nested concurrent", async function () {
-    let fn: jest.Mock<any, any>;
-    fn = jest.fn();
-    let concurrent10Count = 0;
-    let concurrent2Count = 0;
-
-    const iter = pipe(
-      toAsync(range(Infinity)),
-      peek(() => concurrent10Count++),
-      map((a) => delay(100, a)),
-      concurrent(10),
-      peek(() => concurrent2Count++),
-      map((a) => delay(100, a)),
-      filter((a) => a % 2 === 0),
-      concurrent(2),
-    );
-
-    callFuncAfterTime(fn, 300);
-    await iter.next();
-    await iter.next();
-    expect(fn).toBeCalled();
-    expect(concurrent2Count).toEqual(4);
-    expect(concurrent10Count).toEqual(10);
-
-    fn = jest.fn();
-    callFuncAfterTime(fn, 200);
-    await iter.next();
-    await iter.next();
-    expect(fn).toBeCalled();
-    expect(concurrent2Count).toEqual(8);
-    expect(concurrent10Count).toEqual(10);
-
-    fn = jest.fn();
-    callFuncAfterTime(fn, 300);
-    await iter.next();
-    await iter.next();
-    expect(fn).toBeCalled();
-    expect(concurrent2Count).toEqual(12);
-    expect(concurrent10Count).toEqual(20);
-  }, 850);
-
   it("should return IteratorReturnResult after all consuming 'AsyncIterable'", async function () {
     const fn = jest.fn();
     callFuncAfterTime(fn, 1000);
diff --git a/test/every.spec.ts b/test/every.spec.ts
index 84bf13de..9b265a31 100644
--- a/test/every.spec.ts
+++ b/test/every.spec.ts
@@ -3,8 +3,11 @@ import { AsyncFunctionException } from "../src/_internal/error";
 
 describe("every", function () {
   describe("sync", function () {
+    it("should return 'false' if given 'Iterable' is an empty array", function () {
+      expect(every((a) => a, [])).toEqual(false);
+    });
+
     it.each([
-      [(a: number) => a % 2 === 0, [], true],
       [(a: number) => a % 2 === 0, [2, 4, 6, 8, 10], true],
       [(a: number) => a % 2 === 0, [1, 4, 6, 8, 10], false],
       [(a: number) => a % 2 === 0, [2, 4, 7, 8, 10], false],
diff --git a/test/isObject.spec.ts b/test/isObject.spec.ts
deleted file mode 100644
index bf66c103..00000000
--- a/test/isObject.spec.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { isObject } from "../src";
-
-describe("isObject", function () {
-  it.each([
-    [[], true],
-    [{}, true],
-    [() => "", true],
-    [Promise.resolve(), true],
-    [class A {}, true],
-    [new (class A {})(), true],
-    [123, false],
-    ["abc", false],
-    [Symbol("symbol"), false],
-    [null, false],
-    [undefined, false],
-  ])(
-    "should return a boolean value that given value is object or not",
-    function (value, expected) {
-      expect(isObject(value)).toEqual(expected);
-    },
-  );
-});
diff --git a/test/omitBy.spec.ts b/test/omitBy.spec.ts
deleted file mode 100644
index cdfaeb9b..00000000
--- a/test/omitBy.spec.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { omitBy, pipe } from "../src/index";
-
-describe("omitBy", function () {
-  describe("sync", function () {
-    const obj = { a: 1, b: "2", c: true };
-
-    it.each([
-      [
-        ([key, value]: [string, any]) =>
-          key === "b" || typeof value === "boolean",
-        obj,
-      ],
-      [
-        ([key, value]: [string, any]) =>
-          key === "b" ||
-          typeof value === "boolean" ||
-          (typeof value === "symbol" ? Promise.resolve(true) : false),
-        obj,
-      ],
-    ])("should be omitted properties by given predicate function", (f, obj) => {
-      expect(omitBy(f, obj)).toEqual({ a: 1 });
-    });
-
-    it("should be able to be used as a curried function in the pipeline", function () {
-      const res = pipe(
-        { a: 1, b: "2", c: true },
-        omitBy(([key, value]) => key === "b" || typeof value === "boolean"),
-      );
-      expect(res).toEqual({ a: 1 });
-    });
-  });
-
-  describe("async", function () {
-    const obj = { a: 1, b: "2", c: true };
-    it.each([
-      [
-        async ([key, value]: [string, any]) =>
-          key === "b" || typeof value === "boolean",
-        obj,
-      ],
-      [
-        ([key, value]: [string, any]) =>
-          key === "b" || Promise.resolve(typeof value === "boolean"),
-        obj,
-      ],
-    ])(
-      "should be omitted properties by given predicate function",
-      async (f, obj) => {
-        expect(await omitBy(f, obj)).toEqual({ a: 1 });
-      },
-    );
-    it("should be able to be used as a curried function in the pipeline", async function () {
-      const res = await pipe(
-        obj,
-        omitBy(
-          async ([key, value]) => key === "b" || typeof value === "boolean",
-        ),
-      );
-      expect(res).toEqual({ a: 1 });
-    });
-  });
-});
diff --git a/test/pickBy.spec.ts b/test/pickBy.spec.ts
deleted file mode 100644
index 9097de6a..00000000
--- a/test/pickBy.spec.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { pickBy, pipe } from "../src/index";
-
-describe("pickBy", function () {
-  describe("sync", function () {
-    const obj = { a: 1, b: "2", c: true };
-
-    it.each([
-      [
-        ([key, value]: [string, any]) =>
-          key === "b" || typeof value === "boolean",
-        obj,
-      ],
-      [
-        ([key, value]: [string, any]) =>
-          key === "b" ||
-          typeof value === "boolean" ||
-          (typeof value === "symbol" ? Promise.resolve(true) : false),
-        obj,
-      ],
-    ])("should be picked properties by given predicate function", (f, obj) => {
-      expect(pickBy(f, obj)).toEqual({ b: "2", c: true });
-    });
-
-    it("should be able to be used as a curried function in the pipeline", function () {
-      const res = pipe(
-        { a: 1, b: "2", c: true },
-        pickBy(([key, value]) => key === "b" || typeof value === "boolean"),
-      );
-      expect(res).toEqual({ b: "2", c: true });
-    });
-  });
-
-  describe("async", function () {
-    const obj = { a: 1, b: "2", c: true };
-    it.each([
-      [
-        async ([key, value]: [string, any]) =>
-          key === "b" || typeof value === "boolean",
-        obj,
-      ],
-      [
-        ([key, value]: [string, any]) =>
-          key === "b" || Promise.resolve(typeof value === "boolean"),
-        obj,
-      ],
-    ])(
-      "should be picked properties by given predicate function",
-      async (f, obj) => {
-        expect(await pickBy(f, obj)).toEqual({ b: "2", c: true });
-      },
-    );
-    it("should be able to be used as a curried function in the pipeline", async function () {
-      const res = await pipe(
-        obj,
-        pickBy(
-          async ([key, value]) => key === "b" || typeof value === "boolean",
-        ),
-      );
-      expect(res).toEqual({ b: "2", c: true });
-    });
-  });
-});
diff --git a/test/sort.spec.ts b/test/sort.spec.ts
new file mode 100644
index 00000000..8bd6f620
--- /dev/null
+++ b/test/sort.spec.ts
@@ -0,0 +1,67 @@
+import { filter, pipe, sort, toAsync } from "../src/index";
+
+describe("sort", function () {
+  const sortFn = (a: number | string, b: number | string) => {
+    if (a === b) {
+      return 0;
+    }
+    if (a > b) {
+      return 1;
+    }
+    return -1;
+  };
+
+  describe("sync", function () {
+    it("should return 'false' if given iterable is an empty array", function () {
+      expect(sort(sortFn, [])).toEqual([]);
+      expect(sort(sortFn, [3, 4, 1, 2, 5, 2])).toEqual([1, 2, 2, 3, 4, 5]);
+      expect(sort(sortFn, "bcdaef")).toEqual(["a", "b", "c", "d", "e", "f"]);
+    });
+
+    it("should be able to be used as a curried function in the pipeline", function () {
+      const res = pipe(
+        [3, 4, 1, 2, 5, 2],
+        filter((a) => a % 2 !== 0),
+        sort(sortFn),
+      );
+      expect(res).toEqual([1, 3, 5]);
+    });
+  });
+
+  describe("async", function () {
+    it("should return 'false' if given iterable is an empty array", async function () {
+      const sortFn = (a: number | string, b: number | string) => {
+        if (a === b) {
+          return 0;
+        }
+        if (a > b) {
+          return 1;
+        }
+        return -1;
+      };
+
+      expect(await sort(sortFn, toAsync([]))).toEqual([]);
+      expect(await sort(sortFn, toAsync([3, 4, 1, 2, 5, 2]))).toEqual([
+        1, 2, 2, 3, 4, 5,
+      ]);
+      expect(await sort(sortFn, toAsync("bcdaef"))).toEqual([
+        "a",
+        "b",
+        "c",
+        "d",
+        "e",
+        "f",
+      ]);
+    });
+
+    it("should be able to be used as a curried function in the pipeline", async function () {
+      const res = await pipe(
+        [3, 4, 1, 2, 5, 2],
+        toAsync,
+        filter((a) => a % 2 !== 0),
+        sort(sortFn),
+      );
+      expect(res).toEqual([1, 3, 5]);
+    });
+  });
+});
diff --git a/type-check/every.test.ts b/type-check/every.test.ts
index d7f33c10..6b83d02c 100644
--- a/type-check/every.test.ts
+++ b/type-check/every.test.ts
@@ -16,7 +16,7 @@ const res3 = pipe(
 );
 
 checks([
-  check<typeof res0, true, Test.Pass>(),
+  check<typeof res0, false, Test.Pass>(),
   check<typeof res1, boolean, Test.Pass>(),
   check<typeof res2, boolean, Test.Pass>(),
   check<typeof res3, Promise<boolean>, Test.Pass>(),
diff --git a/type-check/isObject.test.ts b/type-check/isObject.test.ts
deleted file mode 100644
index b60fd61b..00000000
--- a/type-check/isObject.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import * as Test from "../src/types/Test";
-import { isObject } from "../src";
-
-const { checks, check } = Test;
-
-const res1 = isObject({});
-const res2 = isObject("a");
-const res3 = isObject(() => "");
-const res4 = isObject(Math.random() > 0.5 ? {} : null);
-
-type Node = {
-  id: number;
-  name: string;
-  child?: Node | number;
-};
-
-function getChildNodeId(node: Node) {
-  if (isObject(node.child)) {
-    return node.child.id;
-  } else {
-    return node.child ?? -1;
-  }
-}
-
-checks([
-  check<typeof res1, boolean, Test.Pass>(),
-  check<typeof res2, boolean, Test.Pass>(),
-  check<typeof res3, boolean, Test.Pass>(),
-  check<typeof res4, boolean, Test.Pass>(),
-  check<ReturnType<typeof getChildNodeId>, number, Test.Pass>(),
-]);
diff --git a/type-check/omitBy.test.ts b/type-check/omitBy.test.ts
deleted file mode 100644
index 04f7c6d2..00000000
--- a/type-check/omitBy.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as Test from "../src/types/Test";
-import { omitBy } from "../src";
-
-const { checks, check } = Test;
-
-const obj = {
-  a: 1,
-  b: "2",
-  c: true,
-};
-
-const res1 = omitBy(([key, value]) => key === "a" || value === true, obj);
-const res2 = omitBy(async ([key, value]) => key === "a" || value === true, obj);
-const res3 = omitBy(
-  ([key, value]) => key === "a" || Promise.resolve(value === true),
-  obj,
-);
-
-type Res = { a?: number; b?: string; c?: boolean };
-
-checks([
-  check<typeof res1, Res, Test.Pass>(),
-  check<typeof res2, Promise<Res>, Test.Pass>(),
-  check<typeof res3, Res | Promise<Res>, Test.Pass>(),
-]);
diff --git a/type-check/pickBy.test.ts b/type-check/pickBy.test.ts
deleted file mode 100644
index 6212861d..00000000
--- a/type-check/pickBy.test.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as Test from "../src/types/Test";
-import { pickBy } from "../src";
-
-const { checks, check } = Test;
-
-const obj = {
-  a: 1,
-  b: "2",
-  c: true,
-};
-
-const res1 = pickBy(([key, value]) => key === "a" || value === true, obj);
-const res2 = pickBy(async ([key, value]) => key === "a" || value === true, obj);
-const res3 = pickBy(
-  ([key, value]) => key === "a" || Promise.resolve(value === true),
-  obj,
-);
-
-type Res = { a?: number; b?: string; c?: boolean };
-
-checks([
-  check<typeof res1, Res, Test.Pass>(),
-  check<typeof res2, Promise<Res>, Test.Pass>(),
-  check<typeof res3, Res | Promise<Res>, Test.Pass>(),
-]);
diff --git a/type-check/sort.test.ts b/type-check/sort.test.ts
new file mode 100644
index 00000000..e1835f78
--- /dev/null
+++ b/type-check/sort.test.ts
@@ -0,0 +1,32 @@
+import * as Test from "../src/types/Test";
+import { pipe, sort, toAsync } from "../src";
+
+const { checks, check } = Test;
+
+const res0 = sort((a, b) => a > b, []);
+const res1 = sort((a, b) => a > b, [1, 2, 3]);
+const res2 = sort((a, b) => a > b, "abc");
+
+const res3 = sort((a, b) => a > b, toAsync([1, 2, 3]));
+const res4 = sort((a, b) => a > b, toAsync("abc"));
+
+const res5 = pipe(
+  [1, 2, 3],
+  sort((a, b) => a > b),
+);
+
+const res6 = pipe(
+  [1, 2, 3],
+  toAsync,
+  sort((a, b) => a > b),
+);
+
+checks([
+  check<typeof res0, any[], Test.Pass>(),
+  check<typeof res1, number[], Test.Pass>(),
+  check<typeof res2, string[], Test.Pass>(),
+  check<typeof res3, Promise<number[]>, Test.Pass>(),
+  check<typeof res4, Promise<string[]>, Test.Pass>(),
+  check<typeof res5, number[], Test.Pass>(),
+  check<typeof res6, Promise<number[]>, Test.Pass>(),
+]);