@@ -939,7 +939,7 @@ jsonld.contextLoaders['node'] = function(options) {
939
939
940
940
/**
941
941
* Assigns the default context loader for external @context URLs to a built-in
942
- * default. Supported types currently include: 'jquery'.
942
+ * default. Supported types currently include: 'jquery' and 'node' .
943
943
*
944
944
* To use the jquery context loader, the 'data' parameter must be a reference
945
945
* to the main jquery object.
@@ -1182,8 +1182,7 @@ jsonld.removeValue = function(subject, property, value, options) {
1182
1182
* 1. They are both primitives of the same type and value.
1183
1183
* 2. They are both @values with the same @value, @type, @language,
1184
1184
* and @index, OR
1185
- * 3. They are both @lists with the same @list and @index, OR
1186
- * 4. They both have @ids they are the same.
1185
+ * 3. They both have @ids they are the same.
1187
1186
*
1188
1187
* @param v1 the first value.
1189
1188
* @param v2 the second value.
@@ -1205,25 +1204,7 @@ jsonld.compareValues = function(v1, v2) {
1205
1204
return true ;
1206
1205
}
1207
1206
1208
- // 3. equal @lists
1209
- if ( _isList ( v1 ) && _isList ( v2 ) ) {
1210
- if ( v1 [ '@index' ] !== v2 [ '@index' ] ) {
1211
- return false ;
1212
- }
1213
- var list1 = v1 [ '@list' ] ;
1214
- var list2 = v2 [ '@list' ] ;
1215
- if ( list1 . length !== list2 . length ) {
1216
- return false ;
1217
- }
1218
- for ( var i = 0 ; i < list1 . length ; ++ i ) {
1219
- if ( ! jsonld . compareValues ( list1 [ i ] , list2 [ i ] ) ) {
1220
- return false ;
1221
- }
1222
- }
1223
- return true ;
1224
- }
1225
-
1226
- // 4. equal @ids
1207
+ // 3. equal @ids
1227
1208
if ( _isObject ( v1 ) && ( '@id' in v1 ) && _isObject ( v2 ) && ( '@id' in v2 ) ) {
1228
1209
return v1 [ '@id' ] === v2 [ '@id' ] ;
1229
1210
}
@@ -6170,6 +6151,21 @@ if(_nodejs) {
6170
6151
jsonld . useContextLoader ( 'node' ) ;
6171
6152
}
6172
6153
6154
+ if ( _nodejs ) {
6155
+ jsonld . use = function ( extension ) {
6156
+ switch ( extension ) {
6157
+ case 'request' :
6158
+ // use node JSON-LD request extension
6159
+ jsonld . request = require ( './request' ) ;
6160
+ break ;
6161
+ default :
6162
+ throw new JsonLdError (
6163
+ 'Unknown extension.' ,
6164
+ 'jsonld.UnknownExtension' , { extension : extension } ) ;
6165
+ }
6166
+ }
6167
+ }
6168
+
6173
6169
// end of jsonld API factory
6174
6170
return jsonld ;
6175
6171
} ;
0 commit comments