Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence. There is an alias to this function called some
.
[predicate]
(Function
): A function to test each element for a condition.[thisArg]
(Any
): Object to use as this when executing callback.
(Observable
): An observable sequence containing a single element determining whether one of the elements in the source sequence pass the test in the specified predicate.
// Without a predicate
var source = Rx.Observable.empty().some();
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
// => Next: false
// => Completed
// With a predicate
var source = Rx.Observable.of(1,2,3,4,5)
.some(function (x) { return x % 2 === 0; });
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
// => Next: true
// => Completed
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests: