@reactivex/ix-es5-esm
Version:
The Interactive Extensions for JavaScript
35 lines (33 loc) • 1.31 kB
JavaScript
import { __values } from "tslib";
/**
* Determines whether any element of an iterable sequence satisfies 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 {FindSubclassedOptions<T, S>} options The options which includes a required predicate, an optional
* thisArg for binding, and an abort signal for cancellation.
* @returns {boolean} Returns a boolean determining whether any elements in the source sequence
* pass the test in the specified predicate.
*/
export function some(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 true;
}
}
}
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 false;
}
//# sourceMappingURL=some.js.map