babel-plugin-null-safe-accessor

0.1.2 • Public • Published

babel-plugin-null-safe-accessor

build status npm version npm downloads

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"]
}

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-null-safe-accessor

Weekly Downloads

1

Version

0.1.2

License

ISC

Last publish

Collaborators

  • shuhei