PageSourceSearch

https://app.schmetterling-argus.de/js/library/jquery-extendext/jQuery.extendext.js

js schmetterling-argus.de collected 2026-09-26 00:00:24 UTC 3,458 bytes, 126 lines download raw bytes

vendor: 3,458 bytes, lines 1-126
1/*!
2 * jQuery.extendext 0.1.1
3 *
4 * Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr)
5 * Licensed under MIT (http://opensource.org/licenses/MIT)
6 * 
7 * Based on jQuery.extend by jQuery Foundation, Inc. and other contributors
8 */
9
10/*jshint -W083 */
11
12(function(root, factory) {
13    if (typeof define === 'function' && define.amd) {
14        define(['jquery'], factory);
15    }
16    else {
17        factory(root.jQuery);
18    }
19}(this, function($) {
20  "use strict";
21
22  $.extendext = function() {
23    var options, name, src, copy, copyIsArray, clone,
24      target = arguments[0] || {},
25      i = 1,
26      length = arguments.length,
27      deep = false,
28      arrayMode = 'default';
29
30    // Handle a deep copy situation
31    if ( typeof target === "boolean" ) {
32      deep = target;
33
34      // Skip the boolean and the target
35      target = arguments[ i++ ] || {};
36    }
37
38    // Handle array mode parameter
39    if ( typeof target === "string" ) {
40      arrayMode = $([target.toLowerCase(), 'default']).filter(['default','concat','replace','extend'])[0];
41
42      // Skip the string param
43      target = arguments[ i++ ] || {};
44    }
45
46    // Handle case when target is a string or something (possible in deep copy)
47    if ( typeof target !== "object" && !$.isFunction(target) ) {
48      target = {};
49    }
50
51    // Extend jQuery itself if only one argument is passed
52    if ( i === length ) {
53      target = this;
54      i--;
55    }
56
57    for ( ; i < length; i++ ) {
58      // Only deal with non-null/undefined values
59      if ( (options = arguments[ i ]) !== null ) {
60        // Special operations for arrays
61        if ($.isArray(options) && arrayMode !== 'default') {
62          clone = target && $.isArray(target) ? target : [];
63
64          switch (arrayMode) {
65          case 'concat':
66            target = clone.concat( $.extend( deep, [], options ) );
67            break;
68
69          case 'replace':
70            target = $.extend( deep, [], options );
71            break;
72
73          case 'extend':
74            options.forEach(function(e, i) {
75              if (typeof e === 'object') {
76                var type = $.isArray(e) ? [] : {};
77                clone[i] = $.extendext( deep, arrayMode, clone[i] || type, e );
78
79              } else if (clone.indexOf(e) === -1) {
80                clone.push(e);
81              }
82            });
83
84            target = clone;
85            break;
86          }
87
88        } else {
89          // Extend the base object
90          for ( name in options ) {
91            src = target[ name ];
92            copy = options[ name ];
93
94            // Prevent never-ending loop
95            if ( target === copy ) {
96              continue;
97            }
98
99            // Recurse if we're merging plain objects or arrays
100            if ( deep && copy && ( $.isPlainObject(copy) ||
101              (copyIsArray = $.isArray(copy)) ) ) {
102
103              if ( copyIsArray ) {
104                copyIsArray = false;
105                clone = src && $.isArray(src) ? src : [];
106
107              } else {
108                clone = src && $.isPlainObject(src) ? src : {};
109              }
110
111              // Never move original objects, clone them
112              target[ name ] = $.extendext( deep, arrayMode, clone, copy );
113
114            // Don't bring in undefined values
115            } else if ( copy !== undefined ) {
116              target[ name ] = copy;
117            }
118          }
119        }
120      }
121    }
122
123    // Return the modified object
124    return target;
125  };
126}));

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.