@reactivex/ix-es5-esm
Version:
The Interactive Extensions for JavaScript
33 lines (31 loc) • 1.26 kB
JavaScript
import { __values } from "tslib";
/**
* Determines whether all elements of an iterable sequence satisfy a condition.
*
* @template T The type of the elements in the source sequence.
* @param {Iterable<T>} source An iterable sequence whose elements to apply the predicate to.
* @param {FindOptions<T>} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation.
* @returns {boolean} A boolean determining whether all elements in the source sequence pass the test in the specified predicate.
*/
export function every(source, options) {
var e_1, _a;
var thisArg = options["thisArg"], predicate = options["predicate"];
var i = 0;
try {
for (var source_1 = __values(source), source_1_1 = source_1.next(); !source_1_1.done; source_1_1 = source_1.next()) {
var item = source_1_1.value;
if (!predicate.call(thisArg, item, i++)) {
return false;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (source_1_1 && !source_1_1.done && (_a = source_1.return)) _a.call(source_1);
}
finally { if (e_1) throw e_1.error; }
}
return true;
}
//# sourceMappingURL=every.js.map