enable to 'operator overload' in JavaScript.
npm install babel-plugin-transform-operator-overload!.github/workflows/main.yml

sh
npm
npm install -D babel-plugin-transform-operator-overloadyarn
yarn add -D babel-plugin-transform-operator-overload
`Usage
Please add this in
babel.config.js.
`json
{
"plugins": [
... ,
"babel-plugin-transform-operator-overload"
],
}
`This plugin works inside a block labeled 'opol'.
`js
opol: {
const c = a + b;
console.log(c);
}
`ā
`js
{
const c = ((left, right) => left["+"] ? left"+" : left + right)(a, b);
console.log(c);
}
`
#### e.g.)
`js
const obj = {
value: 5, '+' {
return this.value + num;
},
'-' {
return this.value - num;
}
};
const puts = { '<<': console.log };
opol: {
puts << 'hello world';
// => hello world
puts << (obj + 3);
// => 8
}
`$3
+ , - , / , % , , * , & , , , >> , >>> , << , ^ , == , === , != , !== , instanceof , > , < , >= , <=`