danylokarpenko/backend-project-lvl2

View on GitHub
src/parsers.js

Summary

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

const parsers = {
  json: JSON.parse,
  yaml: yaml.safeLoad,
  ini: ini.parse,
};

export default (data, type) => parsers[type](data);