babel-plugin-sitrep
Log all assignments and the return value of a function with a simple comment
Example
In
function bar () {
var a = 'foo'
const b = 'bar'
let c = [a, b].map(x => x.charAt(0))
return c.join('-')
}
Out
function bar () {
var a = 'foo'
console.log("a", a);
const b = 'bar'
console.log("b", b);
let c = [a, b].map(x => x.charAt(0))
console.log("c", c);
var __$returnValue = c.join('-');
console.log("Return Value:", __$returnValue);
return __$returnValue;
}
Installation
npm install --save-dev babel-plugin-sitrep
Usage
Via .babelrc
(Recommended)
.babelrc
Without options:
{
"plugins": ["sitrep"]
}
Via CLI
babel --plugins sitrep script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["sitrep"]
});