import dataSource from '../selectors/dataSource';
const getCurrentFileValues = async function getCurrentFileValues(opts) {
  const {
    snapshot,
    values
  } = opts;
  return Promise.all(values.map(async file => {
    const key = file.config.key || file.config.url;
    const atom = dataSource(key);
    const currentValue = await snapshot.getPromise(atom);
    const status = currentValue ? 'formatted' : 'raw';
    return {
      status,
      value: currentValue || file
    };
  }));
};
export default getCurrentFileValues;