Skip to content

“Return if nullish” Babel macro

Notifications You must be signed in to change notification settings

alex-kinokon/return.macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

“Return if nullish” Babel macro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published