jsonld-streaming-parser
Advanced tools
Comparing version 1.0.1 to 1.1.0
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
<a name="v1.1.0"></a> | ||
## [v1.1.0](https://github.com/rubensworks/streaming-jsonld-parser.js/compare/v1.0.1...v1.1.0) - 2019-04-02 | ||
### Added | ||
* [Emit detected contexts via 'context' event](https://github.com/rubensworks/streaming-jsonld-parser.js/commit/a56c1e433072020a999a5595949b89681c378d76) | ||
<a name="v1.0.1"></a> | ||
@@ -5,0 +11,0 @@ ## [v1.0.1](https://github.com/rubensworks/streaming-jsonld-parser.js/compare/v1.0.0...v1.0.1) - 2019-02-13 |
@@ -22,2 +22,3 @@ "use strict"; | ||
parsingContext.contextTree.setContext(keys.slice(0, -1), context); | ||
parsingContext.emitContext(value); | ||
await parsingContext.validateContext(await context); | ||
@@ -24,0 +25,0 @@ } |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import * as RDF from "rdf-js"; | ||
@@ -2,0 +3,0 @@ import { IDocumentLoader, JsonLdContext } from "jsonld-context-parser"; |
@@ -5,2 +5,3 @@ import { ContextParser, IJsonLdContextNormalized } from "jsonld-context-parser"; | ||
import { IJsonLdParserOptions, JsonLdParser } from "./JsonLdParser"; | ||
import { JsonLdContext } from "jsonld-context-parser/lib/JsonLdContext"; | ||
/** | ||
@@ -82,2 +83,7 @@ * Data holder for parsing information. | ||
/** | ||
* Emit the given context into the output stream under the 'context' event. | ||
* @param {JsonLdContext} context A context to emit. | ||
*/ | ||
emitContext(context: JsonLdContext): void; | ||
/** | ||
* Safely get or create the depth value of {@link ParsingContext.unidentifiedValuesBuffer}. | ||
@@ -84,0 +90,0 @@ * @param {number} depth A depth. |
@@ -95,2 +95,9 @@ "use strict"; | ||
/** | ||
* Emit the given context into the output stream under the 'context' event. | ||
* @param {JsonLdContext} context A context to emit. | ||
*/ | ||
emitContext(context) { | ||
this.parser.emit('context', context); | ||
} | ||
/** | ||
* Safely get or create the depth value of {@link ParsingContext.unidentifiedValuesBuffer}. | ||
@@ -97,0 +104,0 @@ * @param {number} depth A depth. |
{ | ||
"name": "jsonld-streaming-parser", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A fast and lightweight streaming JSON-LD parser", | ||
@@ -44,14 +44,14 @@ "keywords": [ | ||
"@types/jest": "^24.0.1", | ||
"@types/jest-each": "^0.3.3", | ||
"@types/jest-each": "^0.3.4", | ||
"@types/node": "^11.9.0", | ||
"arrayify-stream": "^1.0.0", | ||
"coveralls": "^3.0.0", | ||
"jest": "^23.6.0", | ||
"jest-each": "^23.6.0", | ||
"jest": "^24.3.0", | ||
"jest-each": "^24.3.0", | ||
"jest-rdf": "^1.3.0", | ||
"manual-git-changelog": "^1.0.1", | ||
"pre-commit": "^1.2.2", | ||
"rdf-test-suite": "^1.5.2", | ||
"rdf-test-suite": "^1.5.3", | ||
"streamify-string": "^1.0.1", | ||
"ts-jest": "^23.10.5", | ||
"ts-jest": "^24.0.0", | ||
"tslint": "^5.8.0", | ||
@@ -67,3 +67,5 @@ "tslint-eslint-rules": "^5.3.1", | ||
}, | ||
"setupTestFrameworkScriptFile": "jest-rdf", | ||
"setupFilesAfterEnv": [ | ||
"jest-rdf" | ||
], | ||
"transform": { | ||
@@ -70,0 +72,0 @@ "^.+\\.ts$": "ts-jest" |
@@ -97,2 +97,19 @@ # JSON-LD Streaming Parser | ||
### Capture detected contexts | ||
Using a `context` event listener, | ||
you can collect all detected contexts. | ||
```javascript | ||
const myParser = new JsonLdParser(); | ||
const myTextStream = fs.createReadStream('myfile.jsonld'); | ||
myParser.import(myTextStream) | ||
.on('context', console.log) | ||
.on('data', console.error) | ||
.on('error', console.error) | ||
.on('end', () => console.log('All triples were parsed!')); | ||
``` | ||
## Configuration | ||
@@ -99,0 +116,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116480
2248
251