Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
serialize: function (data, baseIRI, options) {
if (options.processingMode && options.processingMode !== '1.0') {
return Promise.reject(
new ErrorSkipped(`Test with processing mode ${options.processingMode} was skipped, only 1.0 is supported.`));
}
if (options.specVersion && options.specVersion !== '1.0') {
return Promise.reject(
new ErrorSkipped(`Test with spec version ${options.specVersion} was skipped, only 1.0 is supported.`));
}
return require('stream-to-string')(require('streamify-array')(data)
.pipe(new JsonLdSerializer(Object.assign({ baseIRI, space: ' ', excludeContext: true }, options))));
},
};
parse: function (data, baseIRI, options) {
if (options.processingMode && options.processingMode !== '1.0') {
return Promise.reject(
new ErrorSkipped(`Test with processing mode ${options.processingMode} was skipped, only 1.0 is supported.`));
}
if (options.specVersion && options.specVersion !== '1.0') {
return Promise.reject(
new ErrorSkipped(`Test with spec version ${options.specVersion} was skipped, only 1.0 is supported.`));
}
return require('arrayify-stream')(require('streamify-string')(data)
.pipe(new JsonLdParser(Object.assign({ baseIRI, allowOutOfOrderContext: true, validateValueIndexes: true }, options))));
},
};