UNPKG

fashion-model

Version:

JavaScript library for defining types and their properties with support for wrapping/unwrapping and serialization/deserialization.

25 lines (22 loc) 622 B
function copyProps (from, to) { Object.getOwnPropertyNames(from).forEach(function (name) { const descriptor = Object.getOwnPropertyDescriptor(from, name); Object.defineProperty(to, name, descriptor); }); } function inherit (ctor, superCtor) { const oldProto = ctor.prototype; const newProto = ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, writable: true, configurable: true } }); copyProps(oldProto, newProto); ctor.$super = superCtor; ctor.prototype = newProto; return ctor; } module.exports = inherit; inherit._inherit = inherit;