1 | import test from '../test.js';
|
2 | /**
|
3 | Test all the values in the collection against a provided predicate.
|
4 |
|
5 | @hidden
|
6 | @param source Source collection to test.
|
7 | @param name The name to call the collection of values, such as `values` or `keys`.
|
8 | @param predicate Predicate to test every item in the source collection against.
|
9 | */
|
10 | const ofType = (source, name, predicate) => {
|
11 | try {
|
12 | for (const item of source) {
|
13 | test(item, name, predicate, false);
|
14 | }
|
15 | return true;
|
16 | }
|
17 | catch (error) {
|
18 | return error.message;
|
19 | }
|
20 | };
|
21 | export default ofType;
|