smartfile/ts/smartfile.interpreter.ts

16 lines
455 B
TypeScript
Raw Normal View History

import "typings-global";
import plugins = require("./smartfile.plugins");
export = function(fileStringArg:string, 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;
}
}