ouuan / fake-luogu-paintboard-server

模拟洛谷冬日绘板服务器,可用于测试脚本。
Apache License 2.0
34 stars 4 forks source link

修复replaceAll函数未定义的bug #3

Closed Zhengfourth closed 3 years ago

Zhengfourth commented 3 years ago

在我所使用的Node.js环境上,字符串类型未定义replaceAll函数,直接运行会出现以下错误:

(node:3964) UnhandledPromiseRejectionWarning: TypeError: data.toString(...).replaceAll is not a function
    at D:\zhengfourth\node-v14.3.0-win-x64\node_modules\fake-luogu-paintboard-server\lib.js:83:8
    at async createServer (D:\zhengfourth\node-v14.3.0-win-x64\node_modules\fake-luogu-paintboard-server\lib.js:81:20)

修复方法:用replace函数和正则表达式代替replaceAll的功能。

Zhengfourth commented 3 years ago

希望进行修复,因为replace函数为标准定义,在所有js实现上均可使用,但是replaceAll不是,在一些环境上无法使用。

ouuan commented 3 years ago

Thanks!