data-pipeline-information-system-sparql
Version:
Sparql function to query/update RDF through SPARQL 1.1
20 lines (16 loc) • 464 B
text/typescript
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;