1. 首页
  2. 数据库
  3. 其它
  4. babel plugin operator:babel插件可让您在javascript中重载运算符 源码

babel plugin operator:babel插件可让您在javascript中重载运算符 源码

上传者: 2021-02-01 22:56:49上传 ZIP文件 6.2KB 热度 10次
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 ;
下载地址
用户评论