Module "operators/throw-if"
Functions
throwIf
- throwIf<T>(conditionFn: (value: T, index: number) => boolean, errorFn: (value: T, index: number) => any): (Anonymous function)
-
Type parameters
Parameters
-
conditionFn: (value: T, index: number) => boolean
-
- (value: T, index: number): boolean
-
Parameters
Returns boolean
-
errorFn: (value: T, index: number) => any
-
- (value: T, index: number): any
Returns (Anonymous function)
Throws the error built by
errorFn
ifconditionFn
evaluates to be truthy.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 ) );