dropInstanceCommon.js 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var getCallback_1 = require("./getCallback");
  4. var getKeyPrefix_1 = require("./getKeyPrefix");
  5. //tslint:disable-next-line:no-ignored-initial-value
  6. function dropInstanceCommon(options, callback) {
  7. var _this = this;
  8. callback = getCallback_1.getCallback.apply(this, arguments);
  9. options = (typeof options !== 'function' && options) || {};
  10. if (!options.name) {
  11. var currentConfig = this.config();
  12. options.name = options.name || currentConfig.name;
  13. options.storeName = options.storeName || currentConfig.storeName;
  14. }
  15. var promise;
  16. if (!options.name) {
  17. promise = Promise.reject('Invalid arguments');
  18. }
  19. else {
  20. promise = new Promise(function (resolve) {
  21. if (!options.storeName) {
  22. resolve(options.name + "/");
  23. }
  24. else {
  25. resolve(getKeyPrefix_1.getKeyPrefix(options, _this._defaultConfig));
  26. }
  27. });
  28. }
  29. return { promise: promise, callback: callback };
  30. }
  31. exports.dropInstanceCommon = dropInstanceCommon;
  32. //# sourceMappingURL=dropInstanceCommon.js.map