Buckets:
| 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 |
Xet Storage Details
- Size:
- 655 Bytes
- Xet hash:
- f74d0c5000baf90296a66aa2645327a669e95665180540cddfc112c20c52e1b3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.