@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
23 lines • 744 B
TypeScript
import { Observable } from "rxjs";
/**
* Throws the error built by `errorFn` if `conditionFn` evaluates to be truthy.
*
* @param conditionFn Determines if an error should be thrown.
* @param errorFn Evaluates to the error which can be thrown.
*
* @example
* ```
* const input = cold(' ft', { f: false, t: true });
* const expected = cold('f#', { f: false }, 'error');
*
* const result = input.pipe(
* // will throw 'error' for values === true
* throwIf(
* (val) => val
* () => error
* )
* );
* ```
*/
export declare function throwIf<T>(conditionFn: (value: T, index: number) => boolean, errorFn: (value: T, index: number) => any): (input: Observable<T>) => Observable<T>;
//# sourceMappingURL=throwIf.d.ts.map