"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fileToObject = fileToObject;
exports.findItemFromList = findItemFromList;

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

function fileToObject(file) {
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, file), {}, {
    lastModified: file.lastModified,
    lastModifiedDate: file.lastModifiedDate,
    name: file.name,
    size: file.size,
    type: file.type,
    uid: file.uid,
    percent: 0,
    originFileObj: file
  });
}

function findItemFromList(file, fileList) {
  var targetKey = file.uid ? 'uid' : 'name';
  return fileList.find(function (item) {
    return item[targetKey] === file[targetKey];
  });
}