Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseShExC (text, mediaType, url, schema, meta, schemaOptions, loadImports) {
var parser = schemaOptions && "parser" in schemaOptions ?
schemaOptions.parser :
ShExParser.construct(url, {}, schemaOptions);
try {
var s = parser.parse(text);
// !! horrible hack until I set a variable to know if there's a BASE.
if (s.base === url) delete s.base;
meta.prefixes = s._prefixes;
meta.base = s._base || meta.base;
ShExUtil.merge(schema, loadImports(s), false, true);
return Promise.resolve([mediaType, url]);
} catch (e) {
e.message = "error parsing ShEx " + url + ": " + e.message;
return Promise.reject(e);
}
}