( f: (...a: A) => B )
| 143 | * @since 4.0.0 |
| 144 | */ |
| 145 | export const liftThrowable = <A extends ReadonlyArray<unknown>, B>( |
| 146 | f: (...a: A) => B |
| 147 | ): (...a: A) => B | undefined => |
| 148 | (...a) => { |
| 149 | try { |
| 150 | return f(...a) |
| 151 | } catch { |
| 152 | return undefined |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Creates a `Reducer` for `UndefinedOr<A>` that prioritizes the first non-`undefined` |