"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isPromise = exports.deepEqual = void 0;

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

var deepEqual = function deepEqual(a, b) {
  if (a === b) return true;
  if (_typeof(a) !== 'object' || _typeof(b) !== 'object' || a === null || b === null) return false;
  var keysA = Object.keys(a),
      keysB = Object.keys(b);
  if (keysA.length !== keysB.length) return false;

  for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
    var key = _keysA[_i];
    if (!keysB.includes(key)) return false;

    if (typeof a[key] === 'function' || typeof b[key] === 'function') {
      if (a[key].toString() !== b[key].toString()) return false;
    } else {
      if (!deepEqual(a[key], b[key])) return false;
    }
  }

  return true;
};

exports.deepEqual = deepEqual;

var isPromise = function isPromise(value) {
  return Boolean(value && typeof value.then === 'function');
};

exports.isPromise = isPromise;