diff --git a/dist/diskdb.js b/dist/diskdb.js index 0755cc0..bc8411f 100644 --- a/dist/diskdb.js +++ b/dist/diskdb.js @@ -14,6 +14,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); //local modules @@ -79,6 +81,16 @@ var DiskDB = function () { } return this; } + }, { + key: 'getCollection', + value: function getCollection(collectionName) { + if (_typeof(this[collectionName]) == (typeof undefined === 'undefined' ? 'undefined' : _typeof(undefined))) { + console.log((0, _chalk.red)('Invalid Collection Name', 'Passed Collection Name Is Not Loaded Yet')); + return false; + } else { + return this[collectionName]; + } + } }]); return DiskDB; diff --git a/lib/diskdb.js b/lib/diskdb.js index 8998cba..9d79817 100644 --- a/lib/diskdb.js +++ b/lib/diskdb.js @@ -55,4 +55,13 @@ export default class DiskDB { return this; } + getCollection(collectionName){ + if(typeof this[collectionName] == typeof undefined){ + console.log(e('Invalid Collection Name', 'Passed Collection Name Is Not Loaded Yet')); + return false + }else{ + return this[collectionName]; + } + } + }