Boilerplate | Sébastien Pierre | Observable
ojs
ojs
ojs
ojs
ojs
md
ojs
ojs
ojs
ojs
ojs
ojs
ojs
md
ojs
ojs
ojs
ojs
ojs
Comments (2)
Jacob Rus
Sep 7, 2020
Why not just use (or make a shortcut to) the Javascript built-in Boolean?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
Or if you are going for speed: bool = _ => !(!_ | (_ === "false"))
Sébastien Pierre
Sep 8, 2020
Boolean("false") returns true, so that won't work, and even though you implementation is potentially faster, it is also less clear. I might change bool to return false for empty arrays as well, like in Python.
Reply
Add comment
Subscribe to notifications
Observable
Sign in
Sébastien Pierre
5
Reply
Add comment
Subscribe to notifications
1
Boilerplate | Sébastien Pierre | Observable