From d55b767039605256c736166a942a9138e3eacfd7 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sun, 29 Jun 2025 11:49:28 -0700 Subject: remove dev node_modules (oops) --- node_modules/rxjs/src/internal/operators/first.ts | 93 ----------------------- 1 file changed, 93 deletions(-) delete mode 100644 node_modules/rxjs/src/internal/operators/first.ts (limited to 'node_modules/rxjs/src/internal/operators/first.ts') diff --git a/node_modules/rxjs/src/internal/operators/first.ts b/node_modules/rxjs/src/internal/operators/first.ts deleted file mode 100644 index 337aa59..0000000 --- a/node_modules/rxjs/src/internal/operators/first.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { Observable } from '../Observable'; -import { EmptyError } from '../util/EmptyError'; -import { OperatorFunction, TruthyTypesOf } from '../types'; -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?: null, defaultValue?: D): OperatorFunction; -export function first(predicate: BooleanConstructor): OperatorFunction>; -export function first(predicate: BooleanConstructor, defaultValue: D): OperatorFunction | D>; -export function first( - predicate: (value: T, index: number, source: Observable) => value is S, - defaultValue?: S -): OperatorFunction; -export function first( - predicate: (value: T, index: number, source: Observable) => value is S, - defaultValue: D -): OperatorFunction; -export function first( - predicate: (value: T, index: number, source: Observable) => boolean, - defaultValue?: D -): OperatorFunction; - -/** - * Emits only the first value (or the first value that meets some condition) - * emitted by the source Observable. - * - * Emits only the first value. Or emits only the first - * value that passes some test. - * - * ![](first.png) - * - * If called with no arguments, `first` emits the first value of the source - * Observable, then completes. If called with a `predicate` function, `first` - * emits the first value of the source that matches the specified condition. Emits an error - * notification if `defaultValue` was not provided and a matching element is not found. - * - * ## Examples - * - * Emit only the first click that happens on the DOM - * - * ```ts - * import { fromEvent, first } from 'rxjs'; - * - * const clicks = fromEvent(document, 'click'); - * const result = clicks.pipe(first()); - * result.subscribe(x => console.log(x)); - * ``` - * - * Emits the first click that happens on a DIV - * - * ```ts - * import { fromEvent, first } from 'rxjs'; - * - * const div = document.createElement('div'); - * div.style.cssText = 'width: 200px; height: 200px; background: #09c;'; - * document.body.appendChild(div); - * - * const clicks = fromEvent(document, 'click'); - * const result = clicks.pipe(first(ev => (ev.target).tagName === 'DIV')); - * result.subscribe(x => console.log(x)); - * ``` - * - * @see {@link filter} - * @see {@link find} - * @see {@link take} - * @see {@link last} - * - * @throws {EmptyError} Delivers an `EmptyError` to the Observer's `error` - * callback if the Observable completes before any `next` notification was sent. - * This is how `first()` is different from `take(1)` which completes instead. - * - * @param predicate An optional function called with each item to test for condition - * matching. - * @param defaultValue The default value emitted in case no valid value was found on - * the source. - * @return A function that returns an Observable that emits the first item that - * matches the condition. - */ -export function first( - predicate?: ((value: T, index: number, source: Observable) => boolean) | null, - defaultValue?: D -): OperatorFunction { - const hasDefaultValue = arguments.length >= 2; - return (source: Observable) => - source.pipe( - predicate ? filter((v, i) => predicate(v, i, source)) : identity, - take(1), - hasDefaultValue ? defaultIfEmpty(defaultValue!) : throwIfEmpty(() => new EmptyError()) - ); -} -- cgit v1.2.3