Repository: sindresorhus/is (ts)

Issue:
feature request: `oneOf` that allows you to check a value against multiple predicates
Similar to https://github.com/sindresorhus/is/issues/95, but this is more of a feature request: `.oneOf` method that allows you to check a value against multiple predicates.

I've implemented it by doing the following:
```js
is.oneOf = (item, predicatesArray) => {
  return predicatesArray.some(predicate => predicate(item));
}
```

To use it:
```js
it("uses is predicates for a true match", () => {
      expect(is.oneOf("hi", [is.function, is.string, is.object])).toEqual(true);
    });
```


Pull request description:
Add support for multiple predicates to `is.any`
Fixes #98

Open to all commentary, especially on type declarations!

Patch:
diff --git a/readme.md b/readme.md
index 94453a9..294cfa7 100644
--- a/readme.md
+++ b/readme.md
@@ -420,9 +420,9 @@ Returns `true` if `value` is an even integer.
 
 Returns `true` if `value` is an odd integer.
 
-##### .any(predicate, ...values)
+##### .any(predicate | predicate[], ...values)
 
-Returns `true` if **any** of the input `values` returns true in the `predicate`:
+Using a single `predicate` argument, returns `true` if **any** of the input `values` returns true in the `predicate`:
 
 ```js
 is.any(is.string, {}, true, '🦄');
@@ -432,6 +432,16 @@ is.any(is.boolean, 'unicorns', [], new Map());
 //=> false
 ```
 
+Using an array of `predicate[]`, returns `true` if **any** of the input `values` returns true for **any** of the `predicates` provided in an array:
+
+```js
+is.any([is.string, is.number], {}, true, '🦄');
+//=> true
+
+is.any([is.boolean, is.number], 'unicorns', [], new Map());
+//=> false
+```
+
 ##### .all(predicate, ...values)
 
 Returns `true` if **all** of the input `values` returns true in the `predicate`:
diff --git a/source/index.ts b/source/index.ts
index 4d42bfe..faabc65 100644
--- a/source/index.ts
+++ b/source/index.ts
@@ -388,7 +388,13 @@ const predicateOnArray = (method: ArrayMethod, predicate: Predicate, values: unk
 	return method.call(values, predicate);
 };
 
-is.any = (predicate: Predicate, ...values: unknown[]): boolean => predicateOnArray(Array.prototype.some, predicate, values);
+is.any = (predicate: Predicate | Predicate[], ...values: unknown[]): boolean => {
+	const predicates = is.array(predicate) ? predicate : [predicate];
+	return predicates.some(singlePredicate =>
+		predicateOnArray(Array.prototype.some, singlePredicate, values)
+	);
+};
+
 is.all = (predicate: Predicate, ...values: unknown[]): boolean => predicateOnArray(Array.prototype.every, predicate, values);
 
 const assertType = (condition: boolean, description: string, value: unknown): asserts condition => {
@@ -526,7 +532,7 @@ interface Assert {
 	inRange: (value: number, range: number | number[]) => asserts value is number;
 
 	// Variadic functions.
-	any: (predicate: Predicate, ...values: unknown[]) => void | never;
+	any: (predicate: Predicate | Predicate[], ...values: unknown[]) => void | never;
 	all: (predicate: Predicate, ...values: unknown[]) => void | never;
 }
 
@@ -616,7 +622,7 @@ export const assert: Assert = {
 	inRange: (value: number, range: number | number[]): asserts value is number => assertType(is.inRange(value, range), AssertionTypeDescription.inRange, value),
 
 	// Variadic functions.
-	any: (predicate: Predicate, ...values: unknown[]): void | never => assertType(is.any(predicate, ...values), AssertionTypeDescription.any, values),
+	any: (predicate: Predicate | Predicate[], ...values: unknown[]): void | never => assertType(is.any(predicate, ...values), AssertionTypeDescription.any, values),
 	all: (predicate: Predicate, ...values: unknown[]): void | never => assertType(is.all(predicate, ...values), AssertionTypeDescription.all, values)
 };
 


Test patch:
diff --git a/test/test.ts b/test/test.ts
index f48b7c3..2909247 100644
--- a/test/test.ts
+++ b/test/test.ts
@@ -1458,6 +1458,8 @@ test('is.any', t => {
 	t.true(is.any(is.object, false, {}, 'unicorns'));
 	t.false(is.any(is.boolean, '🦄', [], 3));
 	t.false(is.any(is.integer, true, 'lol', {}));
+	t.true(is.any([is.string, is.number], {}, true, '🦄'));
+	t.false(is.any([is.boolean, is.number], 'unicorns', [], new Map()));
 
 	t.throws(() => {
 		is.any(null as any, true);