"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));

var _isString = _interopRequireDefault(require("lodash/isString"));

var _loadStatus = _interopRequireDefault(require("./loadStatus"));

function isImageString(image) {
  return (0, _isString.default)(image);
}

function isImageObject(image) {
  return (0, _isPlainObject.default)(image);
}

var formatImages = function formatImages(images) {
  var previewImages = [];
  (images || []).forEach(function (image) {
    if (isImageString(image)) {
      previewImages.push({
        src: image
      });
    } else if (isImageObject(image)) {
      previewImages.push({
        src: image.src,
        originSrc: image.originSrc,
        loaded: _loadStatus.default.before
      });
    }
  });
  return previewImages;
};

var _default = formatImages;
exports.default = _default;