Sha256: ca87ad9b77a5e4f8b1776cb9cf3cc395184a0fb0eb7c266d925267e7e9c40ae0
Contents?: true
Size: 656 Bytes
Versions: 14
Compression:
Stored size: 656 Bytes
Contents
function singleOrDefaultAsync(source, hasDefault, defaultValue) { return new AnonymousObservable(function (o) { var value = defaultValue, seenValue = false; return source.subscribe(function (x) { if (seenValue) { o.onError(new Error('Sequence contains more than one element')); } else { value = x; seenValue = true; } }, function (e) { o.onError(e); }, function () { if (!seenValue && !hasDefault) { o.onError(new EmptyError()); } else { o.onNext(value); o.onCompleted(); } }); }, source); }
Version data entries
14 entries across 7 versions & 1 rubygems