aquaform/project-lvl2-s96

View on GitHub
src/parsersList.js

Summary

Maintainability
A
0 mins
Test Coverage
import jsYaml from 'js-yaml';
import ini from 'ini';

const parseFunctionList = {
  '.json': data => JSON.parse(data),
  '.yml': data => jsYaml.safeLoad(data),
  '.ini': data => ini.parse(data) };

export default ext => data => parseFunctionList[ext](data);