0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

booleanに変換

Posted at
/**
* 入力値がブール値または文字列 'true' であるかを確認し、ブール値を返します。
*
* @param value - ブール値に変換する値。
* @returns 入力値に基づくブール値。
*/
export const toBool = (value: string | boolean) =>
 value === 'true' || value === true

意外と便利なので投稿しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?