@sharyn/util.inlinethrow

inlineThrow is a function that throws its argument. Unlike a regular throw, it's an expression and can be used anywhere.

Usage no npm install needed!

<script type="module">
  import sharynUtilInlinethrow from 'https://cdn.skypack.dev/@sharyn/util.inlinethrow';
</script>

README

🌹 inlineThrow

inlineThrow is a function that throws its argument. Unlike a regular throw, it's an expression and can be used anywhere.

const number = isNan(string) ? inlineThrow(Error('Not a number')) : parseInt(string)

inlineThrow is part of @sharyn/util