createClass.js 621 B

1234567891011121314151617
  1. export default (function () {
  2. function defineProperties(target, props) {
  3. for (var i = 0; i < props.length; i++) {
  4. var descriptor = props[i];
  5. descriptor.enumerable = descriptor.enumerable || false;
  6. descriptor.configurable = true;
  7. if ("value" in descriptor) descriptor.writable = true;
  8. Object.defineProperty(target, descriptor.key, descriptor);
  9. }
  10. }
  11. return function (Constructor, protoProps, staticProps) {
  12. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  13. if (staticProps) defineProperties(Constructor, staticProps);
  14. return Constructor;
  15. };
  16. })();