diff --git a/lib/pouch-utils.js b/lib/pouch-utils.js index 021b8cb..c14a27e 100644 --- a/lib/pouch-utils.js +++ b/lib/pouch-utils.js @@ -1,6 +1,23 @@ 'use strict'; -var Promise = require('pouchdb-promise'); +/* istanbul ignore next */ +function _interopDefault (ex) { + if(ex && (typeof ex === 'object') && 'default' in ex) { + return ex['default']; + } + return ex; +} + +/* istanbul ignore next */ +function _getPromise() { + if(typeof Promise === 'function') { + return Promise; + } + return _interopDefault(require('pouchdb-promise')); +} + +var Promise = _getPromise(); + /* istanbul ignore next */ exports.once = function (fun) { var called = false;