This is RxJS v 4. Find the latest version here
Returns the last 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 last 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(1,2,3,1,2,3)
.lastIndexOf(3);
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
// => Next: 5
// => Completed
/* With an index */
var source = Rx.Observable.of(1,2,3,1,2,3)
.lastIndexOf(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: 5
// => Completed
File:
Dist:
Prerequisites:
NPM Packages:
NuGet Packages:
Unit Tests: