pnpm
Version:
Fast, disk space efficient package manager
31 lines (25 loc) • 627 B
JavaScript
/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */
import Sink from './Pipe'
export default function IndexSink (i, sink) {
this.sink = sink
this.index = i
this.active = true
this.value = void 0
}
IndexSink.prototype.event = function (t, x) {
if (!this.active) {
return
}
this.value = x
this.sink.event(t, this)
}
IndexSink.prototype.end = function (t, x) {
if (!this.active) {
return
}
this.active = false
this.sink.end(t, { index: this.index, value: x })
}
IndexSink.prototype.error = Sink.prototype.error