question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RA.EnsureNumber, RA.EnsureString, RA.EnsureBoolean

See original GitHub issue

How 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:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Undistractioncommented, Mar 31, 2018

@guillaumearm I’d argue that it would still make sense for consistency - we wrap Number.isNaN for isNaN for example.

1reaction
Undistractioncommented, Mar 30, 2018

We already have ensureArray for exactly that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found