@pro-script/as-is
Version:
Check your types at runtime with ESNext syntax by meta programing in node.js and browser with interfaces, types, strict object and more.
16 lines (14 loc) • 566 B
JavaScript
export default class BaseInterface {
constructor(otherClass = BaseInterface) {
const meOut = {};
Object
.getOwnPropertyNames(otherClass.prototype)
.filter((item)=> item !== 'constructor' )
.forEach((property)=> meOut[property] = otherClass.prototype[property]());
Object
.getOwnPropertyNames(otherClass)
.filter((item)=> !['length', 'name', 'prototype'].includes(item))
.forEach((property)=> meOut[property] = otherClass[property]());
return meOut;
}
}