initial commit - far from runnable
This commit is contained in:
commit
db057ce342
8614 changed files with 1032171 additions and 0 deletions
24
node_modules/rxjs/dist/esm/internal/firstValueFrom.js
generated
vendored
Normal file
24
node_modules/rxjs/dist/esm/internal/firstValueFrom.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { EmptyError } from './util/EmptyError';
|
||||
import { SafeSubscriber } from './Subscriber';
|
||||
export function firstValueFrom(source, config) {
|
||||
const hasConfig = typeof config === 'object';
|
||||
return new Promise((resolve, reject) => {
|
||||
const subscriber = new SafeSubscriber({
|
||||
next: (value) => {
|
||||
resolve(value);
|
||||
subscriber.unsubscribe();
|
||||
},
|
||||
error: reject,
|
||||
complete: () => {
|
||||
if (hasConfig) {
|
||||
resolve(config.defaultValue);
|
||||
}
|
||||
else {
|
||||
reject(new EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
source.subscribe(subscriber);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=firstValueFrom.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue