es6-class-prototype
Version:
get prototype from es6 class, like old way
36 lines (31 loc) • 1.17 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EsClassPrototype = {}));
})(this, (function (exports) { 'use strict';
function classPrototype(target, all) {
let desc = Object.getOwnPropertyDescriptors(target.prototype);
let prototype = Object.keys(desc).reduce(function (a, b) {
if (all || !desc[b].get && !desc[b].set) {
a[b] = target.prototype[b];
}
return a;
}, {});
return Object.assign({}, target.prototype, prototype);
}
{
Object.defineProperty(classPrototype, "__esModule", {
value: true
});
Object.defineProperty(classPrototype, 'classPrototype', {
value: classPrototype
});
Object.defineProperty(classPrototype, 'default', {
value: classPrototype
});
}
exports.classPrototype = classPrototype;
exports["default"] = classPrototype;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=index.umd.development.cjs.map