babel-plugin-null-safe-accessor
v0.1.2
Published
A Babel plugin to provide null safe accessor syntax like Groovy's
Downloads
22
Readme
babel-plugin-null-safe-accessor
A Babel plugin to provide null safe accessor syntax like Groovy's.
This plugin requires npm@3
's flattened node_modules
because of monkey-patching to babel's dependencies.
Before:
var b = a?.b;
a.b?(c);
After:
var b = a == null ? a : a.b;
a.b == null ? a.b : a.b(c);
Installation
npm install -D babel-plugin-null-safe-accessor
.babelrc:
{
"plugins": ["null-safe-accessor"]
}