Compiles away hnt
function calls so you can get ergonomic and safety benefits of hnt without the increased bundle size.
In
// input code
hnt(myArray, "[0].potentialValue", 42)
Out
"use strict";
// output code
myArray && myArray[0] && myArray[0].potentialValue || 42;
$ npm install babel-plugin-hnt
.babelrc
{
"plugins": ["hnt"]
}
$ babel --plugins hnt script.js
require("babel-core").transform("code", {
plugins: ["hnt"]
});