1(function($) { 2 if (!$ || !$.extend) return; 3 4 var originalExtend = $.extend; 5 6 function isPlainObject(obj) { 7 if (obj === null || typeof obj !== 'object') { 8 return false; 9 } 10 var proto = Object.getPrototypeOf(obj); 11 return proto === null || proto === Object.prototype; 12 } 13 14 $.extend = function() { 15 var args = Array.prototype.slice.call(arguments); 16 var deep = false; 17 var i = 0; 18 19 if (typeof args[0] === 'boolean') { 20 deep = args[0]; 21 i = 1; 22 } 23 24 if (!deep) { 25 return originalExtend.apply($, args); 26 } 27 28 function sanitize(obj) { 29 if (!isPlainObject(obj)) { 30 return obj; 31 } 32 if (Array.isArray(obj)) { 33 return obj; 34 } 35 var clean = {}; 36 for (var key in obj) { 37 if (obj.hasOwnProperty(key)) { 38 if (key === '__proto__' || key === 'constructor' || key === 'prototype') { 39 continue; 40 } 41 clean[key] = sanitize(obj[key]); 42 } 43 } 44 return clean; 45 } 46 47 for (var j = i + 1; j < args.length; j++) { 48 if (args[j] && typeof args[j] === 'object') { 49 args[j] = sanitize(args[j]); 50 } 51 } 52 53 return originalExtend.apply($, args); 54 }; 55 56 for (var prop in originalExtend) { 57 if (originalExtend.hasOwnProperty(prop)) { 58 $.extend[prop] = originalExtend[prop]; 59 } 60 } 61})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.