export function satisfiesConcept(obj, pure_virtual, virtual, debug) { if (typeof obj !== 'object' || obj === null) { return false; } if (debug) { const missingMethods = [] pure_virtual.forEach((method) => { if (typeof obj[method] !== 'function') { missingMethods.push(method) } }) virtual.forEach((method) => { if (!(method in obj)) { missingMethods.push(method) } }) if (missingMethods.length !== 0) { console.debug(obj.constructor.name, missingMethods) return false } } else { if (!pure_virtual.every((method) => typeof obj[method] === 'function')) { return false; } if (!virtual.every((method) => method in obj)) { return false; } } return true }