OpenHPS/openhps-rdf

View on GitHub
src/models/utils.ts

Summary

Maintainability
A
0 mins
Test Coverage
/**
 *
 * @param derivedCtor
 * @param constructors
 */
export function applyMixins(derivedCtor: any, constructors: any[]) {
    constructors.forEach((baseCtor) => {
        Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
            if (derivedCtor.prototype[name]) {
                return;
            }
            Object.defineProperty(
                derivedCtor.prototype,
                name,
                Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null),
            );
        });
    });
}