"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.cloneAny = void 0;
var _lodash = _interopRequireDefault(require("lodash"));
const cloneAny = original => {
  let cloned = null;
  if (Array.isArray(original)) {
    cloned = cloneArray(original);
  } else if (_lodash.default.isObject(original)) {
    cloned = cloneObject(original);
  } else {
    cloned = original;
  }
  return cloned;
};
exports.cloneAny = cloneAny;
const cloneArray = originalArray => {
  let clonedArray = [];
  for (let c = 0; c < originalArray.length; c++) {
    let arrValue = originalArray[c];
    if (Array.isArray(arrValue)) {
      clonedArray.push(cloneArray(arrValue));
    } else if (_lodash.default.isObject(arrValue)) {
      clonedArray.push(cloneObject(arrValue));
    } else {
      clonedArray.push(arrValue);
    }
  }
  return clonedArray;
};
const cloneObject = originalObject => {
  let clonedObject = {};
  for (let prop in originalObject) {
    let value = originalObject[prop];
    if (Array.isArray(value)) {
      clonedObject[prop] = cloneArray(value);
    } else if (_lodash.default.isObject(value)) {
      clonedObject[prop] = cloneObject(value);
    } else {
      clonedObject[prop] = value;
    }
  }
  return clonedObject;
};