babel-plugin-operator 描述 这是一个插件,可将运算符重载添加到javascript中。 例子 1个 以下是在平面上实现简单点或向量的示例。 我们应该允许程序员add两个点或multiply一个点multiply某个因子。 class Point { x = 0 ; y = 0 ; constructor ( _x , _y ) { if ( _x ) this . x = _x ; if ( _y ) this . y = _y ; } operatorAdd = ( b ) => { const a = this ;