Allow optional chaining operator in JS
What does this MR do?
Changes your life. You may never have to write &&
again.
Instead of writing gl && gl.currentUser && gl.currentUser.name
write gl?.currentUser?.name
!!
Or checking things in DOM where the element may or may not exist:
document.querySelector('input[name=foo]')?.value
NB: This is still stage 1 proposal. But a pretty great thing. And all the items mentioning stage 2 are checked off
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides
Edited by Simon Knox