cascade-extend 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,169 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ 381:
6
+ /***/ ((module) => {
7
+
8
+
9
+
10
+ var hasOwn = Object.prototype.hasOwnProperty;
11
+ var toStr = Object.prototype.toString;
12
+ var defineProperty = Object.defineProperty;
13
+ var gOPD = Object.getOwnPropertyDescriptor;
14
+
15
+ var isArray = function isArray(arr) {
16
+ if (typeof Array.isArray === 'function') {
17
+ return Array.isArray(arr);
18
+ }
19
+
20
+ return toStr.call(arr) === '[object Array]';
21
+ };
22
+
23
+ var isPlainObject = function isPlainObject(obj) {
24
+ if (!obj || toStr.call(obj) !== '[object Object]') {
25
+ return false;
26
+ }
27
+
28
+ var hasOwnConstructor = hasOwn.call(obj, 'constructor');
29
+ var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
30
+ // Not own constructor property must be Object
31
+ if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
32
+ return false;
33
+ }
34
+
35
+ // Own properties are enumerated firstly, so to speed up, if last one is own, then all properties are own.
36
+ var key;
37
+ for (key in obj) { /**/ }
38
+
39
+ return typeof key === 'undefined' || hasOwn.call(obj, key);
40
+ };
41
+
42
+ // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
43
+ var setProperty = function setProperty(target, options) {
44
+ if (defineProperty && options.name === '__proto__') {
45
+ defineProperty(target, options.name, {
46
+ enumerable: true,
47
+ configurable: true,
48
+ value: options.newValue,
49
+ writable: true
50
+ });
51
+ } else {
52
+ // eslint-disable-next-line no-param-reassign
53
+ target[options.name] = options.newValue;
54
+ }
55
+ };
56
+
57
+ // Return undefined instead of __proto__ if '__proto__' is not an own property
58
+ var getProperty = function getProperty(obj, name) {
59
+ if (name === '__proto__') {
60
+ if (!hasOwn.call(obj, name)) {
61
+ return void 0;
62
+ } else if (gOPD) {
63
+ // In early versions of node, obj['__proto__'] is buggy when obj has __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
64
+ return gOPD(obj, name).value;
65
+ }
66
+ }
67
+
68
+ return obj[name];
69
+ };
70
+
71
+ module.exports = function extend() {
72
+ var options, name, src, copy, copyIsArray, clone;
73
+ var target = arguments[0];
74
+ var i = 1;
75
+ var length = arguments.length;
76
+ var deep = false;
77
+
78
+ // Handle a deep copy situation
79
+ if (typeof target === 'boolean') {
80
+ deep = target;
81
+ target = arguments[1] || {};
82
+ // skip the boolean and the target
83
+ i = 2;
84
+ }
85
+ if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
86
+ target = {};
87
+ }
88
+
89
+ for (; i < length; ++i) {
90
+ options = arguments[i];
91
+ // Only deal with non-null/undefined values
92
+ if (options != null) {
93
+ // Extend the base object
94
+ for (name in options) {
95
+ src = getProperty(target, name);
96
+ copy = getProperty(options, name);
97
+
98
+ // Prevent never-ending loop
99
+ if (target !== copy) {
100
+ // Recurse if we're merging plain objects or arrays
101
+ if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
102
+ if (copyIsArray) {
103
+ copyIsArray = false;
104
+ clone = []; //clone = src && isArray(src) ? src : [];
105
+ } else {
106
+ clone = src && isPlainObject(src) ? src : {};
107
+ }
108
+
109
+ // Never move original objects, clone them
110
+ setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
111
+
112
+ // Don't bring in undefined values
113
+ } else if (typeof copy !== 'undefined') {
114
+ setProperty(target, { name: name, newValue: copy });
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ // Return the modified object
122
+ return target;
123
+ };
124
+
125
+
126
+ /***/ })
127
+
128
+ /******/ });
129
+ /************************************************************************/
130
+ /******/ // The module cache
131
+ /******/ var __webpack_module_cache__ = {};
132
+ /******/
133
+ /******/ // The require function
134
+ /******/ function __webpack_require__(moduleId) {
135
+ /******/ // Check if module is in cache
136
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
137
+ /******/ if (cachedModule !== undefined) {
138
+ /******/ return cachedModule.exports;
139
+ /******/ }
140
+ /******/ // Create a new module (and put it into the cache)
141
+ /******/ var module = __webpack_module_cache__[moduleId] = {
142
+ /******/ // no module.id needed
143
+ /******/ // no module.loaded needed
144
+ /******/ exports: {}
145
+ /******/ };
146
+ /******/
147
+ /******/ // Execute the module function
148
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
149
+ /******/
150
+ /******/ // Return the exports of the module
151
+ /******/ return module.exports;
152
+ /******/ }
5
153
  /******/
6
154
  /************************************************************************/
155
+ /******/ /* webpack/runtime/compat get default export */
156
+ /******/ (() => {
157
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
158
+ /******/ __webpack_require__.n = (module) => {
159
+ /******/ var getter = module && module.__esModule ?
160
+ /******/ () => (module['default']) :
161
+ /******/ () => (module);
162
+ /******/ __webpack_require__.d(getter, { a: getter });
163
+ /******/ return getter;
164
+ /******/ };
165
+ /******/ })();
166
+ /******/
7
167
  /******/ /* webpack/runtime/define property getters */
8
168
  /******/ (() => {
9
169
  /******/ // define getter functions for harmony exports
@@ -34,13 +194,18 @@
34
194
  /******/
35
195
  /************************************************************************/
36
196
  var __webpack_exports__ = {};
197
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
198
+ (() => {
37
199
  __webpack_require__.r(__webpack_exports__);
38
200
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
39
201
  /* harmony export */ "default": () => (/* binding */ cascadeExtend)
40
202
  /* harmony export */ });
203
+ /* harmony import */ var _zhennann_extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(381);
204
+ /* harmony import */ var _zhennann_extend__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_zhennann_extend__WEBPACK_IMPORTED_MODULE_0__);
41
205
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
42
206
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
43
207
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
208
+
44
209
  function cascadeExtend(_ref) {
45
210
  var scope = _ref.scope,
46
211
  source = _ref.source,
@@ -59,14 +224,14 @@ function cascadeExtend(_ref) {
59
224
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
60
225
  var key = _step.value;
61
226
  if (key === name) {
62
- extend(true, result, source[key]);
227
+ _zhennann_extend__WEBPACK_IMPORTED_MODULE_0___default()(true, result, source[key]);
63
228
  } else {
64
229
  var parts = key.substring(nameLength + 1).split('_');
65
230
  var test = parts.every(function (part) {
66
231
  return !!scope[part];
67
232
  });
68
233
  if (test) {
69
- extend(true, result, source[key]);
234
+ _zhennann_extend__WEBPACK_IMPORTED_MODULE_0___default()(true, result, source[key]);
70
235
  }
71
236
  }
72
237
  }
@@ -77,6 +242,8 @@ function cascadeExtend(_ref) {
77
242
  }
78
243
  return result;
79
244
  }
245
+ })();
246
+
80
247
  module.exports = __webpack_exports__;
81
248
  /******/ })()
82
249
  ;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":";;UAAA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;ACNe,SAASA,aAAaA,CAAAC,IAAA,EAA0B;EAAA,IAAvBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;EACzD,IAAI,CAACD,MAAM,IAAI,CAACC,IAAI,EAAE,OAAO,IAAI;EACjC,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACF,MAAM,CAAC,CAACI,MAAM,CAAC,UAAAC,GAAG,EAAI;IAC7C,OAAOA,GAAG,KAAKJ,IAAI,IAAII,GAAG,CAACC,OAAO,CAACL,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;EACtD,CAAC,CAAC;EACF,IAAIC,IAAI,CAACK,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAClC,IAAIL,IAAI,CAACK,MAAM,KAAK,CAAC,IAAIL,IAAI,CAAC,CAAC,CAAC,KAAKD,IAAI,EAAE,OAAOD,MAAM,CAACE,IAAI,CAAC,CAAC,CAAC,CAAC;EACjE,IAAMM,MAAM,GAAG,CAAC,CAAC;EACjB,IAAMC,UAAU,GAAGR,IAAI,CAACM,MAAM;EAAC,IAAAG,SAAA,GAAAC,0BAAA,CACbT,IAAI;IAAAU,KAAA;EAAA;IAAtB,KAAAF,SAAA,CAAAG,CAAA,MAAAD,KAAA,GAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,GAAwB;MAAA,IAAbV,GAAG,GAAAO,KAAA,CAAAI,KAAA;MACZ,IAAIX,GAAG,KAAKJ,IAAI,EAAE;QAChBgB,MAAM,CAAC,IAAI,EAAET,MAAM,EAAER,MAAM,CAACK,GAAG,CAAC,CAAC;MACnC,CAAC,MAAM;QACL,IAAMa,KAAK,GAAGb,GAAG,CAACc,SAAS,CAACV,UAAU,GAAG,CAAC,CAAC,CAACW,KAAK,CAAC,GAAG,CAAC;QACtD,IAAMC,IAAI,GAAGH,KAAK,CAACI,KAAK,CAAC,UAAAC,IAAI;UAAA,OAAI,CAAC,CAACxB,KAAK,CAACwB,IAAI,CAAC;QAAA,EAAC;QAC/C,IAAIF,IAAI,EAAE;UACRJ,MAAM,CAAC,IAAI,EAAET,MAAM,EAAER,MAAM,CAACK,GAAG,CAAC,CAAC;QACnC;MACF;IACF;EAAC,SAAAmB,GAAA;IAAAd,SAAA,CAAAe,CAAA,CAAAD,GAAA;EAAA;IAAAd,SAAA,CAAAgB,CAAA;EAAA;EACD,OAAOlB,MAAM;AACf,C","sources":["webpack://cascade-extend/webpack/bootstrap","webpack://cascade-extend/webpack/runtime/define property getters","webpack://cascade-extend/webpack/runtime/hasOwnProperty shorthand","webpack://cascade-extend/webpack/runtime/make namespace object","webpack://cascade-extend/./src/main.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export default function cascadeExtend({ scope, source, name }) {\n if (!source || !name) return null;\n const keys = Object.keys(source).filter(key => {\n return key === name || key.indexOf(name + '_') === 0\n });\n if (keys.length === 0) return null;\n if (keys.length === 1 && keys[0] === name) return source[keys[0]];\n const result = {};\n const nameLength = name.length;\n for (const key of keys) {\n if (key === name) {\n extend(true, result, source[key]);\n } else {\n const parts = key.substring(nameLength + 1).split('_');\n const test = parts.every(part => !!scope[part]);\n if (test) {\n extend(true, result, source[key]);\n }\n }\n }\n return result;\n}"],"names":["cascadeExtend","_ref","scope","source","name","keys","Object","filter","key","indexOf","length","result","nameLength","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","extend","parts","substring","split","test","every","part","err","e","f"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":";;;;;;;AAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,YAAY;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,QAAQ;AACR;AACA;;AAEA;AACA,4BAA4B,iDAAiD;;AAE7E;AACA,OAAO;AACP,4BAA4B,4BAA4B;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;UCnHA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;ACNsC;AAEvB,SAASC,aAAaA,CAAAC,IAAA,EAA0B;EAAA,IAAvBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;EACzD,IAAI,CAACD,MAAM,IAAI,CAACC,IAAI,EAAE,OAAO,IAAI;EACjC,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACF,MAAM,CAAC,CAACI,MAAM,CAAC,UAAAC,GAAG,EAAI;IAC7C,OAAOA,GAAG,KAAKJ,IAAI,IAAII,GAAG,CAACC,OAAO,CAACL,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;EACtD,CAAC,CAAC;EACF,IAAIC,IAAI,CAACK,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAClC,IAAIL,IAAI,CAACK,MAAM,KAAK,CAAC,IAAIL,IAAI,CAAC,CAAC,CAAC,KAAKD,IAAI,EAAE,OAAOD,MAAM,CAACE,IAAI,CAAC,CAAC,CAAC,CAAC;EACjE,IAAMM,MAAM,GAAG,CAAC,CAAC;EACjB,IAAMC,UAAU,GAAGR,IAAI,CAACM,MAAM;EAAC,IAAAG,SAAA,GAAAC,0BAAA,CACbT,IAAI;IAAAU,KAAA;EAAA;IAAtB,KAAAF,SAAA,CAAAG,CAAA,MAAAD,KAAA,GAAAF,SAAA,CAAAI,CAAA,IAAAC,IAAA,GAAwB;MAAA,IAAbV,GAAG,GAAAO,KAAA,CAAAI,KAAA;MACZ,IAAIX,GAAG,KAAKJ,IAAI,EAAE;QAChBL,uDAAM,CAAC,IAAI,EAAEY,MAAM,EAAER,MAAM,CAACK,GAAG,CAAC,CAAC;MACnC,CAAC,MAAM;QACL,IAAMY,KAAK,GAAGZ,GAAG,CAACa,SAAS,CAACT,UAAU,GAAG,CAAC,CAAC,CAACU,KAAK,CAAC,GAAG,CAAC;QACtD,IAAMC,IAAI,GAAGH,KAAK,CAACI,KAAK,CAAC,UAAAC,IAAI;UAAA,OAAI,CAAC,CAACvB,KAAK,CAACuB,IAAI,CAAC;QAAA,EAAC;QAC/C,IAAIF,IAAI,EAAE;UACRxB,uDAAM,CAAC,IAAI,EAAEY,MAAM,EAAER,MAAM,CAACK,GAAG,CAAC,CAAC;QACnC;MACF;IACF;EAAC,SAAAkB,GAAA;IAAAb,SAAA,CAAAc,CAAA,CAAAD,GAAA;EAAA;IAAAb,SAAA,CAAAe,CAAA;EAAA;EACD,OAAOjB,MAAM;AACf,C","sources":["webpack://cascade-extend/./node_modules/@zhennann/extend/index.js","webpack://cascade-extend/webpack/bootstrap","webpack://cascade-extend/webpack/runtime/compat get default export","webpack://cascade-extend/webpack/runtime/define property getters","webpack://cascade-extend/webpack/runtime/hasOwnProperty shorthand","webpack://cascade-extend/webpack/runtime/make namespace object","webpack://cascade-extend/./src/main.js"],"sourcesContent":["'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up, if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = []; //clone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import extend from '@zhennann/extend';\n\nexport default function cascadeExtend({ scope, source, name }) {\n if (!source || !name) return null;\n const keys = Object.keys(source).filter(key => {\n return key === name || key.indexOf(name + '_') === 0\n });\n if (keys.length === 0) return null;\n if (keys.length === 1 && keys[0] === name) return source[keys[0]];\n const result = {};\n const nameLength = name.length;\n for (const key of keys) {\n if (key === name) {\n extend(true, result, source[key]);\n } else {\n const parts = key.substring(nameLength + 1).split('_');\n const test = parts.every(part => !!scope[part]);\n if (test) {\n extend(true, result, source[key]);\n }\n }\n }\n return result;\n}"],"names":["extend","cascadeExtend","_ref","scope","source","name","keys","Object","filter","key","indexOf","length","result","nameLength","_iterator","_createForOfIteratorHelper","_step","s","n","done","value","parts","substring","split","test","every","part","err","e","f"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cascade-extend",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "cascade-extend",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
package/src/main.js CHANGED
@@ -1,3 +1,5 @@
1
+ import extend from '@zhennann/extend';
2
+
1
3
  export default function cascadeExtend({ scope, source, name }) {
2
4
  if (!source || !name) return null;
3
5
  const keys = Object.keys(source).filter(key => {