2016-05-19 22:31:53 +00:00
|
|
|
/// <reference path="./typings/index.d.ts" />
|
2016-03-20 16:36:38 +00:00
|
|
|
"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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-05-19 22:31:53 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5pbnRlcnByZXRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw2Q0FBNkM7O0FBRTdDLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFFaEQsaUJBQVMsVUFBUyxhQUFvQixFQUFFLFdBQVc7SUFDL0MsTUFBTSxDQUFDLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQztRQUNsQixLQUFLLEtBQUssQ0FBRTtRQUNaLEtBQUssTUFBTTtZQUNQLE1BQU0sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNoRCxLQUFLLE1BQU07WUFDUCxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUNyQztZQUNJLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxHQUFHLGdCQUFnQixDQUFDLENBQUM7WUFDNUUsS0FBSyxDQUFDO0lBQ2QsQ0FBQztBQUNMLENBQU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