UNPKG

1.12 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4Object.defineProperty(exports, "__esModule", {
5 value: true
6});
7exports.default = void 0;
8var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9function composeProps(originProps, patchProps, isAll) {
10 var composedProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, originProps), isAll ? patchProps : {});
11 Object.keys(patchProps).forEach(function (key) {
12 var func = patchProps[key];
13 if (typeof func === 'function') {
14 composedProps[key] = function () {
15 var _originProps$key;
16 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
17 args[_key] = arguments[_key];
18 }
19 func.apply(void 0, args);
20 return (_originProps$key = originProps[key]) === null || _originProps$key === void 0 ? void 0 : _originProps$key.call.apply(_originProps$key, [originProps].concat(args));
21 };
22 }
23 });
24 return composedProps;
25}
26var _default = exports.default = composeProps;
\No newline at end of file