0.1.1 • Published 4 years ago

return.macro v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

return.macro

License dependency status npm version

Example

import _return from "return.macro"

const value = getValue() ?? _return()
const [left, right] = getValue() ?? _return(false)
const { node } = getValue() ?? _return()

desugars to

const value = getValue();
if (value == null) return;

const [left, right] = getValue();
if (left == null || right == null) return false;

const { node} = getValue();
if (node == null) return;