Skip to content

Commit

Permalink
feat(utils): include undefined value in getMaybeBooleanFromRichBoolean()
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Mar 14, 2024
1 parent 3b8002c commit 31c7f5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/utils/__tests__/getMaybeBooleanFromRichBoolean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ describe('utils/getMaybeBooleanFromRichBoolean()', () => {

expect(result).toBeUndefined()
})

it('should return `undefined` for `undefined`', () => {
const result = getMaybeBooleanFromRichBoolean(undefined)

expect(result).toBeUndefined()
})
})
4 changes: 2 additions & 2 deletions src/utils/getMaybeBooleanFromRichBoolean.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RichBoolean } from '../constants'

export function getMaybeBooleanFromRichBoolean(richBoolean: RichBoolean): boolean | undefined {
switch (richBoolean) {
export function getMaybeBooleanFromRichBoolean(value: RichBoolean | undefined): boolean | undefined {
switch (value) {
case RichBoolean.FALSE:
return false

Expand Down

0 comments on commit 31c7f5f

Please sign in to comment.