Skip to content

Commit

Permalink
Merge pull request #1309 from yamada-ui/feat/utils/is-boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
hirotomoyamada committed Apr 28, 2024
2 parents 640fc4f + 4abbdab commit 169a760
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-buckets-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yamada-ui/utils": minor
---

Added `isBoolean` function.
5 changes: 2 additions & 3 deletions packages/components/calendar/src/month.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
cx,
dataAttr,
filterUndefined,
isBoolean,
isNull,
isUndefined,
} from "@yamada-ui/utils"
Expand Down Expand Up @@ -205,9 +206,7 @@ export const Month: FC<MonthProps> = ({
})

const isDisplayed =
!isNull(day) &&
!isUndefined(day) &&
typeof day !== "boolean"
!isNull(day) && !isUndefined(day) && !isBoolean(day)

return (
<ui.td
Expand Down
3 changes: 3 additions & 0 deletions packages/utils/src/assertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export const isNumeric = (value: any): boolean =>
export const isString = (value: any): value is string =>
Object.prototype.toString.call(value) === "[object String]"

export const isBoolean = (value: any): value is boolean =>
typeof value === "boolean"

export const isUndefined = (value: any): value is undefined =>
typeof value === "undefined" && value === undefined

Expand Down

0 comments on commit 169a760

Please sign in to comment.