npm.io
1.0.0 • Published 8 years ago

babel-plugin-hnt

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0

babel-plugin-hnt

Compiles away hnt function calls so you can get ergonomic and safety benefits of hnt without the increased bundle size.

Example

In

// input code
hnt(myArray, "[0].potentialValue", 42)

Out

"use strict";

// output code
myArray && myArray[0] && myArray[0].potentialValue || 42;

Installation

$ npm install babel-plugin-hnt

Usage

.babelrc

{
  "plugins": ["hnt"]
}
Via CLI
$ babel --plugins hnt script.js
Via Node API
require("babel-core").transform("code", {
  plugins: ["hnt"]
});

Keywords