liferay / liferay-npm-tools

Collection of tools for using npm in Liferay
Other
18 stars 15 forks source link

Enable nullish coalescing and optional chaining #450

Closed wincent closed 4 years ago

wincent commented 4 years ago

Both at Stage 4, and would clean up statements like this:

const dataSetItem =
    action.payload.dataSetItems && action.payload.dataSetItems[key] !== undefined
        ? action.payload.dataSetItems[key]
        : FALLBACK_DATA_SET_ITEM;

Because we can instead do:

const dataSetItem =
    action.payload.dataSetItems?.[key] ?? FALLBACK_DATA_SET_ITEM;

Creating this because I want to link to this example from this PR.