大家好,我在看源码时发现optimizeCb
函数,第一个判断条件if (context === void 0) return func;
其中func,我打印了下如下:
ƒ (name) {
_['is' + name] = function(obj) {
return toString.call(obj) === '[object ' + name + ']';
};
}
ƒ (name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
push.apply(args, arguments);
return result(this, func.apply(_, args));
ƒ (name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
var obj = this._wrapped;
method.apply(obj, arguments);
if ((name === 'shift' || name === 'splice') && obj.leng…
ƒ (name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
return result(this, method.apply(this._wrapped, arguments));
};
}
ƒ alert() { [native code] }
总共是五个函数:关于这五个函数不知甚解,所以劳烦各位,知道给讲解下,打扰了。