RA.EnsureNumber, RA.EnsureString, RA.EnsureBoolean
See original GitHub issueHow about some functions for coercing values if they aren’t already that type.
const ensureString = unless(isString, toString)
const ensureNumber = unless(isNumber, Number)
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@guillaumearm I’d argue that it would still make sense for consistency - we wrap
Number.isNaN
forisNaN
for example.We already have
ensureArray
for exactly that.