File tree Expand file tree Collapse file tree 4 files changed +7913
-3463
lines changed
Expand file tree Collapse file tree 4 files changed +7913
-3463
lines changed Original file line number Diff line number Diff line change 105105
106106# Database
107107* .db
108+
109+ # Jest
110+ * .test.js
Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ function close() {
2424/**
2525 * Dynamically opens and closes a database if a file is provided.
2626 * @param {string } file
27- * @returns {Promise<Function> }
27+ * @returns {void| Promise<Function> }
2828 */
2929function dynamicAccess ( file ) {
3030 // If file is undefined or db is already open, do nothing
31- if ( ! file || db ) {
31+ if ( ! file || db instanceof PromiseDB ) {
3232 return ;
3333 }
3434
@@ -47,8 +47,13 @@ module.exports = {
4747 // Export database open/close functions (synchronous!)
4848 open, close,
4949
50- print : function ( ) {
51- console . log ( typeof db ) ;
50+ /**
51+ * Retrieves the database, if open.
52+ * @returns {PromiseDB }
53+ */
54+ getDatabase : function ( ) {
55+ if ( db instanceof PromiseDB ) return db ;
56+ throw new Error ( 'Database is not open.' ) ;
5257 } ,
5358
5459 /**
You can’t perform that action at this time.
0 commit comments