Boilerplate | Sébastien Pierre | Observable
ojs
ojs
ojs
ojs
ojs
md
ojs
ojs
ojs
ojs
ojs
ojs
ojs
md
ojs
ojs
ojs
ojs
ojs
Author
Sébastien Pierre
@sebastien
Using Observable for software engineering, programming language and user interface research.
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
© 2026 Observable, Inc.
Terms of service
Privacy policy
Product
About
Pricing
Documentation
Release notes
Contact us
Open source
Notebook Kit
Plot
D3
Community
Explore
Forum
Bluesky
YouTube
X
1
Follow
Follow
Boilerplate | Sébastien Pierre | Observable