jsonld-streaming-parser
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -222,2 +222,8 @@ /// <reference types="node" /> | ||
rdfstarReverseInEmbedded?: boolean; | ||
/** | ||
* If the APIs you interact with publish valid JSON-LD on media types that are not application/ld+json, | ||
* provide those content-types in this array. | ||
* Default to ['application/activity+json'] | ||
*/ | ||
wellKnownMediaTypes?: string[]; | ||
} |
@@ -65,4 +65,8 @@ "use strict"; | ||
let context; | ||
// Special cases when receiving something else than the JSON-LD media type | ||
if (mediaType !== 'application/ld+json') { | ||
let wellKnownMediaTypes = ['application/activity+json']; | ||
if (options && options.wellKnownMediaTypes) { | ||
wellKnownMediaTypes = options.wellKnownMediaTypes; | ||
} | ||
// Special cases when receiving something else than the JSON-LD media type or the wellKnownMediaTypes | ||
if (mediaType !== 'application/ld+json' && !wellKnownMediaTypes.includes(mediaType)) { | ||
// Only accept JSON or JSON extension types | ||
@@ -69,0 +73,0 @@ if (mediaType !== 'application/json' && !mediaType.endsWith('+json')) { |
{ | ||
"name": "jsonld-streaming-parser", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "A fast and lightweight streaming JSON-LD parser", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -184,2 +184,3 @@ # JSON-LD Streaming Parser | ||
* `rdfstarReverseInEmbedded`: If embedded nodes in JSON-LD star can have reverse properties. _(Default: `false`)_ | ||
* `wellKnownMediaTypes`: an array of media types that can also be parsed as JSON-LD. _(Default: `['application/activity+json']`)_ | ||
@@ -186,0 +187,0 @@ ```javascript |
Sorry, the diff of this file is not supported yet
453096
4072
317