frontend/.pnpm-store/v3/files/29/166fee26ab7a193cc229e5997b5c506a80a6a7409b48cc917cfa6fc7008fa88b91150eef467d1cbf13ec0909c8c1c2b9c5bf5d0c5288603261a863ec3018c5

13 lines
763 B
Plaintext

/** PURE_IMPORTS_START _util_EmptyError,_filter,_take,_defaultIfEmpty,_throwIfEmpty,_util_identity PURE_IMPORTS_END */
import { EmptyError } from '../util/EmptyError';
import { filter } from './filter';
import { take } from './take';
import { defaultIfEmpty } from './defaultIfEmpty';
import { throwIfEmpty } from './throwIfEmpty';
import { identity } from '../util/identity';
export function first(predicate, defaultValue) {
var hasDefaultValue = arguments.length >= 2;
return function (source) { return source.pipe(predicate ? filter(function (v, i) { return predicate(v, i, source); }) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new EmptyError(); })); };
}
//# sourceMappingURL=first.js.map