putout
Version:
🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json
26 lines (19 loc) • 412 B
JavaScript
;
const name = '[transform]';
const returns = (a) => () => a;
module.exports = (line) => {
if (!line)
return [];
const [from, to] = line.split('->');
const report = returns(line);
const replace = returns({
[from]: to,
});
const plugin = [
name, {
report,
replace,
},
];
return [plugin];
};