UNPKG

@roderickhsiao/react-i13n

Version:

[Experiment] React I13n provides a performant and scalable solution to application instrumentation.

39 lines (33 loc) 1.17 kB
"use strict"; exports.__esModule = true; exports["default"] = void 0; /** * Copyright 2015 - Present, Yahoo Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ /** * Add prototype/static properties to the target * please note that this is a helper function to generate the i13n component, * just assign properties anyways instead of handling the React life cycle * @method augmentComponent * @param {Object} target React component * @param {Object} prototypeProps the prototype source to augment target * @param {Object} staticProps the static source to augment target */ function augmentComponent(target, prototypeProps, staticProps) { if (prototypeProps === void 0) { prototypeProps = {}; } if (staticProps === void 0) { staticProps = {}; } Object.getOwnPropertyNames(prototypeProps).forEach(function (name) { if (name !== 'constructor') { Object.defineProperty(target.prototype, name, Object.getOwnPropertyDescriptor(prototypeProps, name)); } }); Object.assign(target, staticProps); return target; } var _default = augmentComponent; exports["default"] = _default;