docs: function skladConnection_count() {
          const isMulti = (arguments.length === 1 && typeof arguments[0] === 'object');
          const objStoreNames = isMulti ? Object.keys(arguments[0]) : [arguments[0]];
          let data;
  
          if (isMulti) {
              data = arguments[0];
          } else {
              data = {};
              data[arguments[0]] = (typeof arguments[1] === 'function') ? null : arguments[1];
          }
  
          const allObjStoresExist = checkContainingStores.call(this, objStoreNames);
          if (!allObjStoresExist) {
              const err = createError('NotFoundError', `Database ${this.database.name} (version ${this.database.version}) doesn't contain all needed stores`);
              return Promise.reject(err);
          }
  
          return new Promise((resolve, reject) => {
              const result = {};
              let transaction;
              let countRequest;
              let abortErr;
  
              // Safari9 can't run multi-objectstore transactions
              // divide one transaction into many with one object store to fix this
              try {
                  transaction = this.database.transaction(objStoreNames, TRANSACTION_READONLY);
              } catch (ex) {
                  if (ex.name === 'NotFoundError') {
                      const promises = {};
  
                      objStoreNames.forEach(objStoreName => {
                          const promise = this.count(objStoreName, data[objStoreName]);
                          promises[objStoreName] = promise;
                      });
  
                      resolveAllPromises(promises).then(resolve).catch(reject);
                  } else {
                      reject(ex);
                  }
  
                  return;
              }
  
              transaction.oncomplete = transaction.onerror = transaction.onabort = function skladConnection_count_onFinish(evt) {
                  const err = abortErr || evt.target.error;
                  const isSuccess = !err && evt.type === 'complete';
  
                  if (isSuccess) {
                      resolve(isMulti ? result : result[objStoreNames[0]]);
                  } else {
                      reject(ensureError(err));
                  }
  
                  if (evt.type === 'error') {
                      evt.preventDefault();
                  }
              };
  
              for (let objStoreName in data) {
                  const objStore = transaction.objectStore(objStoreName);
                  const options = data[objStoreName] || {};
                  const rangeArgs = (options.range instanceof IDBKeyRangeRef) ? [options.range] : [];
  
                  if (options.index) {
                      if (!objStore.indexNames.contains(options.index)) {
                          abortErr = createError('NotFoundError', `Object store ${objStore.name} doesn't contain "${options.index}" index`);
                          return;
                      }
  
                      try {
                          const index = objStore.index(options.index);
                          countRequest = index.count(...rangeArgs);
                      } catch (ex) {
                          abortErr = ex;
                          return;
                      }
                  } else {
                      try {
                          countRequest = objStore.count(...rangeArgs);
                      } catch (ex) {
                          abortErr = ex;
                          return;
                      }
                  }
  
                  countRequest.onsuccess = function (evt) {
                      result[objStoreName] = evt.target.result || 0;
                  };
              }
          });
      }