Closed hzoo closed 4 years ago
logicalCOALESCE
? Too much of a mouthful? logicalQQ
?
I started referring to this as the existential operator in the slides.
@gisenberg feel free to edit the title/etc (if your in the tc39 team it gives you write access to this repo)
Parser PR: babel/babylon#761, follow-up: babel/babylon#762 Transform PR: babel/babel#6483
What is the status of this? Is it ready to use?
Yes, just enable the @babel/plugin-proposal-nullish-coalescing-operator
plugin.
https://www.npmjs.com/package/@babel/plugin-proposal-nullish-coalescing-operator
Champions: @gisenberg Spec Repo: https://github.com/gisenberg/proposal-nullary-coalescing First presented at the July 2017 meeting: slides Moved to Stage 1 at the Sept 2017 meeting: slides
Syntax
so most use
const variable = a || b
but a falsy value like0 or '' or false
will unintentionally returnb
as the value.Notes:
Parsing
https://twitter.com/littledan/status/908032146484469761 https://github.com/babel/babylon/pull/742/files#r142008197