Skip to content

Commit 24aeb2c

Browse files
committed
Fix abstract class check
1 parent ea8f89f commit 24aeb2c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

JavaScript/1-file-storage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const readline = require('readline');
66
class Database {
77
constructor() {
88
const proto = Object.getPrototypeOf(this);
9-
if (proto === Database) {
9+
if (proto.constructor === Database) {
1010
throw new Error('abstract class should not be instanciated');
1111
}
1212
}
@@ -19,7 +19,7 @@ class Database {
1919
class Cursor {
2020
constructor() {
2121
const proto = Object.getPrototypeOf(this);
22-
if (proto === Cursor) {
22+
if (proto.constructor === Cursor) {
2323
throw new Error('abstract class should not be instanciated');
2424
}
2525
this.current = 0;

0 commit comments

Comments
 (0)