UNPKG

@adikari/config-manager

Version:

Tool to deploy configs to different stores

18 lines (11 loc) 356 B
'use strict'; const yaml = require('js-yaml'); const parseYML = contents => yaml.safeLoad(contents, { json: true }); const isYAML = filePath => filePath.endsWith('.yml'); const parse = ({ filePath, contents }) => { if (isYAML(filePath)) { return parseYML(contents); } throw new Error('Unsupported file type') }; module.exports = { parse };