Fix using is.array in is.all (#125)
This commit is contained in:
parent
5feadcb0b8
commit
d8ced89efe
2 changed files with 3 additions and 1 deletions
|
|
@ -170,7 +170,7 @@ is.array = <T = unknown>(value: unknown, assertion?: (value: T) => value is T):
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!assertion) {
|
if (!is.function_(assertion)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1537,6 +1537,8 @@ test('is.all', t => {
|
||||||
t.false(is.all(is.string, '🦄', []));
|
t.false(is.all(is.string, '🦄', []));
|
||||||
t.false(is.all(is.set, new Map(), {}));
|
t.false(is.all(is.set, new Map(), {}));
|
||||||
|
|
||||||
|
t.true(is.all(is.array, ...[['1'], ['2']]));
|
||||||
|
|
||||||
t.throws(() => {
|
t.throws(() => {
|
||||||
is.all(null as any, true);
|
is.all(null as any, true);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue