Proposal: throw null operator

IdkGoodName Vilius viliuskubilius416 at
Sun Feb 24 14:43:38 UTC 2019

I am proposing a syntatic sugar, which would check if throw value is not
null, or not undefined. It would make less typing and no if, for throw
statements. Syntax is simple. Here's an example of it:
throw? e
This is basically equivalent to:
if(e !== null && e !== undefined) throw e
What's the purpose of that? Well, in some node js modules, error as null,
or undefined is sometimes passed.
Example of that is:
const {exec} = require('child_process')
exec('...', {cwd: '...'}, (err, stdout, stderr) => {
    if(err !== null) throw err

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list