1 | import is from '@sindresorhus/is';
|
2 | import test from '../test.js';
|
3 | const ofTypeDeep = (object, predicate) => {
|
4 | if (!is.plainObject(object)) {
|
5 | test(object, 'deep values', predicate, false);
|
6 | return true;
|
7 | }
|
8 | return Object.values(object).every(value => ofTypeDeep(value, predicate));
|
9 | };
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | const ofTypeDeepSafe = (object, predicate) => {
|
18 | try {
|
19 | return ofTypeDeep(object, predicate);
|
20 | }
|
21 | catch (error) {
|
22 | return error.message;
|
23 | }
|
24 | };
|
25 | export default ofTypeDeepSafe;
|