putout
Version:
🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json
24 lines (18 loc) • 395 B
JavaScript
const name = '[transform]';
const returns = (a) => () => a;
export default (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];
};