diff --git a/src/database.js b/src/database.js index b3d474e..1c218d6 100644 --- a/src/database.js +++ b/src/database.js @@ -64,6 +64,10 @@ class Database { return this.list().find((data) => data.id == id) } + toString() { + return JSON.stringify(this.listJSON()) + } + } module.exports = { diff --git a/src/object.js b/src/object.js index f685da0..2bfedcf 100644 --- a/src/object.js +++ b/src/object.js @@ -68,6 +68,10 @@ class DatabaseObject { return this.getProps() .reduce((json = {}, prop) => ({ ...json, [prop]: this.readString(prop) }), {}) } + + toString() { + return JSON.stringify(this.toJSON()) + } } module.exports = {