UNPKG

707 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const is_1 = require("@sindresorhus/is");
4const __1 = require("..");
5const ofTypeDeep = (object, predicate) => {
6 if (!is_1.default.plainObject(object)) {
7 __1.default(object, predicate);
8 return true;
9 }
10 return Object.values(object).every(value => ofTypeDeep(value, predicate));
11};
12/**
13Test all the values in the object against a provided predicate.
14
15@hidden
16
17@param predicate - Predicate to test every value in the given object against.
18*/
19exports.default = (object, predicate) => {
20 try {
21 return ofTypeDeep(object, predicate);
22 }
23 catch (error) {
24 return error.message;
25 }
26};