1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const __1 = require("..");
|
4 | const test_1 = require("../test");
|
5 | // TODO: After we migrate all usages of this function to specify the optional 'name' parameter, we can change the parameter to be required.
|
6 | /**
|
7 | Test all the values in the collection against a provided predicate.
|
8 |
|
9 | @hidden
|
10 | @param source Source collection to test.
|
11 | @param predicate Predicate to test every item in the source collection against.
|
12 | @param name The name to call the collection of values, such as `values` or `keys`. If it is `undefined`, it uses the call stack to infer the label.
|
13 | */
|
14 | exports.default = (source, predicate, name) => {
|
15 | try {
|
16 | for (const item of source) {
|
17 | if (name) {
|
18 | test_1.default(item, name, predicate, false);
|
19 | }
|
20 | else {
|
21 | __1.default(item, predicate);
|
22 | }
|
23 | }
|
24 | return true;
|
25 | }
|
26 | catch (error) {
|
27 | return error.message;
|
28 | }
|
29 | };
|