Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Created February 3, 2014 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazywithclass/8794193 to your computer and use it in GitHub Desktop.
Save lazywithclass/8794193 to your computer and use it in GitHub Desktop.
First version of CoffeeScript's ?. in JavaScript thanks to sweet.js
macro ?. {
rule infix {
$lhs:expr | $rhs:expr
} => {
$lhs && $lhs.$rhs
}
}
// obj?.possiblyNullProperty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment