smartfile/dist/smartfile.interpreter.js

18 lines
2.0 KiB
JavaScript
Raw Normal View History

/// <reference path="./typings/index.d.ts" />
"use strict";
var plugins = require("./smartfile.plugins");
module.exports = function (fileStringArg, fileTypeArg) {
switch (fileTypeArg) {
case "yml":
case "yaml":
return plugins.yaml.safeLoad(fileStringArg);
case "json":
return JSON.parse(fileStringArg);
default:
plugins.beautylog.error("file type " + fileTypeArg.blue + " not supported");
break;
}
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5pbnRlcnByZXRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2Q0FBNkM7O0FBRTdDLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFFaEQsaUJBQVMsVUFBUyxhQUFvQixFQUFFLFdBQVc7SUFDL0MsTUFBTSxDQUFDLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQztRQUNsQixLQUFLLEtBQUssQ0FBRTtRQUNaLEtBQUssTUFBTTtZQUNQLE1BQU0sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNoRCxLQUFLLE1BQU07WUFDUCxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNyQztZQUNJLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxHQUFHLGdCQUFnQixDQUFDLENBQUM7WUFDNUUsS0FBSyxDQUFDO0lBQ2QsQ0FBQztBQUNMLENBQUMsQ0FBQSIsImZpbGUiOiJzbWFydGZpbGUuaW50ZXJwcmV0ZXIuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL2luZGV4LmQudHNcIiAvPlxy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