Skip to content

Commit d22563f

Browse files
committed
#29 - Javascript
1 parent 5cf6ed0 commit d22563f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Roadmap/29 - SOLID ISP/javascript/parababire.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,15 @@ Object.assign(ColorPrinter.prototype, scanner)
155155
const multifuncional = new ColorPrinter()
156156
multifuncional.print()
157157
multifuncional.sendFax()
158-
multifuncional.scanning()
158+
multifuncional.scanning()
159+
160+
function testInterface(object, interface) {
161+
const prototypeProperties = Object.getOwnPropertyNames(interface.prototype)
162+
163+
for (const method of prototypeProperties) {
164+
if (!object[method] || typeof object[method] !== 'function') {
165+
throw new Error(`La clase no implementa el método ${method} de la interface.`)
166+
}
167+
}
168+
}
169+
testInterface(multifuncional, Printer)

0 commit comments

Comments
 (0)