3737const RDFC10 = require ( './RDFC10' ) ;
3838const RDFC10Sync = require ( './RDFC10Sync' ) ;
3939
40- // optional native support
41- let rdfCanonizeNative ;
42- try {
43- rdfCanonizeNative = require ( 'rdf-canonize-native' ) ;
44- } catch ( e ) { }
45-
4640// return a dataset from input dataset or n-quads
4741function _inputToDataset ( input , options ) {
4842 if ( options . inputFormat ) {
@@ -80,20 +74,6 @@ function _traceURDNA2015() {
8074exports . NQuads = require ( './NQuads' ) ;
8175exports . IdentifierIssuer = require ( './IdentifierIssuer' ) ;
8276
83- /**
84- * Get or set native API.
85- *
86- * @param {object } [api] - The native API.
87- *
88- * @returns {object } - The currently set native API.
89- */
90- exports . _rdfCanonizeNative = function ( api ) {
91- if ( api ) {
92- rdfCanonizeNative = api ;
93- }
94- return rdfCanonizeNative ;
95- } ;
96-
9777/**
9878 * Asynchronously canonizes an RDF dataset.
9979 *
@@ -118,7 +98,6 @@ exports._rdfCanonizeNative = function(api) {
11898 * falsy for a JSON dataset.
11999 * {string} [format] - The format of the output. Omit or use
120100 * 'application/n-quads' for a N-Quads string.
121- * {boolean} [useNative=false] - Use native implementation.
122101 * {number} [maxWorkFactor=1] - Control of the maximum number of times to run
123102 * deep comparison algorithms (such as the N-Degree Hash Quads algorithm
124103 * used in RDFC-1.0) before bailing out and throwing an error; this is a
@@ -148,19 +127,6 @@ exports.canonize = async function(input, options = {}) {
148127 const dataset = _inputToDataset ( input , options ) ;
149128 _checkOutputFormat ( options ) ;
150129
151- if ( options . useNative ) {
152- if ( ! rdfCanonizeNative ) {
153- throw new Error ( 'rdf-canonize-native not available' ) ;
154- }
155- if ( options . createMessageDigest ) {
156- throw new Error (
157- '"createMessageDigest" cannot be used with "useNative".' ) ;
158- }
159- return new Promise ( ( resolve , reject ) =>
160- rdfCanonizeNative . canonize ( dataset , options , ( err , canonical ) =>
161- err ? reject ( err ) : resolve ( canonical ) ) ) ;
162- }
163-
164130 if ( ! ( 'algorithm' in options ) ) {
165131 throw new Error ( 'No RDF Dataset Canonicalization algorithm specified.' ) ;
166132 }
@@ -202,7 +168,6 @@ exports.canonize = async function(input, options = {}) {
202168 * falsy for a JSON dataset.
203169 * {string} [format] - The format of the output. Omit or use
204170 * 'application/n-quads' for a N-Quads string.
205- * {boolean} [useNative=false] - Use native implementation.
206171 * {number} [maxWorkFactor=1] - Control of the maximum number of times to run
207172 * deep comparison algorithms (such as the N-Degree Hash Quads algorithm
208173 * used in RDFC-1.0) before bailing out and throwing an error; this is a
@@ -236,16 +201,6 @@ exports._canonizeSync = function(input, options = {}) {
236201 const dataset = _inputToDataset ( input , options ) ;
237202 _checkOutputFormat ( options ) ;
238203
239- if ( options . useNative ) {
240- if ( ! rdfCanonizeNative ) {
241- throw new Error ( 'rdf-canonize-native not available' ) ;
242- }
243- if ( options . createMessageDigest ) {
244- throw new Error (
245- '"createMessageDigest" cannot be used with "useNative".' ) ;
246- }
247- return rdfCanonizeNative . canonizeSync ( dataset , options ) ;
248- }
249204 if ( ! ( 'algorithm' in options ) ) {
250205 throw new Error ( 'No RDF Dataset Canonicalization algorithm specified.' ) ;
251206 }
0 commit comments