'use strict';

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


/**
 * When a component has ImportSpecifier data, change it from an object to an array
 */
function updateImportSpecifiers(versionModel) {
  if (!versionModel.dependencies || !versionModel.dependencies.length) return versionModel;
  versionModel.dependencies.forEach(function (dependency) {
    dependency.relativePaths.forEach(function (relativePath) {
      if (relativePath.importSpecifier) {
        relativePath.importSpecifiers = [relativePath.importSpecifier];
        delete relativePath.importSpecifier;
      }
    });
  });
  return versionModel;
}

exports.default = {
  name: 'change ImportSpecifier from Object to Array',
  migrate: updateImportSpecifiers
};