Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
searchElement
(Any
): The value to locate in the source sequence.[fromIndex]
(Number
): The index to start the search. If not specified, defaults to 0.
(Observable
): And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
/* Without an index */
var source = Rx.Observable.of(42)
.indexOf(42);
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
// => Next: 0
// => Completed
/* With an index */
var source = Rx.Observable.of(1,2,3)
.indexOf(2, 1);
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
// => Next: 0
// => Completed
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests: