Skip to content

Commit

Permalink
feat: flatMapNullable
Browse files Browse the repository at this point in the history
  • Loading branch information
sukovanej committed May 23, 2023
1 parent b811e0f commit be0057c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/IOOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ export const fromNullableK: <A extends ReadonlyArray<unknown>, B>(
) => (...a: A) => IOOption<NonNullable<B>> = /*#__PURE__*/ OT.fromNullableK(I.Pointed)

/**
* @category sequencing
* Alias of `flatMapNullable`.
*
* @category legacy
* @since 2.12.0
*/
export const chainNullableK: <A, B>(
Expand Down
2 changes: 1 addition & 1 deletion test/IOOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ describe.concurrent('IOOption', () => {
})

it('flatMapNullable', () => {
const f = _.chainNullableK((n: number) => (n > 0 ? n : n === 0 ? null : undefined))
const f = _.flatMapNullable((n: number) => (n > 0 ? n : n === 0 ? null : undefined))
U.deepStrictEqual(f(_.of(1))(), O.some(1))
U.deepStrictEqual(f(_.of(0))(), O.none)
U.deepStrictEqual(f(_.of(-1))(), O.none)
Expand Down

0 comments on commit be0057c

Please sign in to comment.