import YAML = require('yamljs');


export function load(filePath: string) {
    let extension = filePath.substring(filePath.lastIndexOf('.') + 1, filePath.length) || filePath;
    let jsonObject;
    switch (extension) {
        case 'yaml':
        case 'yml':
            jsonObject = YAML.load(filePath);
            break;
        case 'json':
            jsonObject = require(filePath);
            break;
    }
    return jsonObject;
}

export default load;
