Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue#51#TypescriptFlexibility #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dist/diskdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions lib/diskdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}

}