Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 772 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 772 Bytes

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;