frontend/.pnpm-store/v3/files/02/fc76ccd56d830c39e02c0999622a205e8db16f7844908ed945fac8fa82ab1493a056abd4bcc16699450a1675806d219ab266e314d2aaa7adcd194d7d766983

27 lines
814 B
Plaintext

import { EmptyError } from './util/EmptyError';
export function lastValueFrom(source, config) {
var hasConfig = typeof config === 'object';
return new Promise(function (resolve, reject) {
var _hasValue = false;
var _value;
source.subscribe({
next: function (value) {
_value = value;
_hasValue = true;
},
error: reject,
complete: function () {
if (_hasValue) {
resolve(_value);
}
else if (hasConfig) {
resolve(config.defaultValue);
}
else {
reject(new EmptyError());
}
},
});
});
}
//# sourceMappingURL=lastValueFrom.js.map