Comparing version 0.1.19 to 0.1.20
{ | ||
"name": "jsonld", | ||
"version": "0.1.19", | ||
"version": "0.1.20", | ||
"description": "A JSON-LD Processor and API implementation in JavaScript.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/digitalbazaar/jsonld.js", |
@@ -105,2 +105,24 @@ jsonld.js | ||
// serialize a document to N-Quads (RDF) | ||
jsonld.toRDF(doc, {format: 'application/nquads'}, function(err, nquads) { | ||
// nquads is a string of nquads | ||
}); | ||
// deserialize N-Quads (RDF) to JSON-LD | ||
jsonld.fromRDF(nquads, {format: 'application/nquads'}, function(err, doc) { | ||
// doc is JSON-LD | ||
}); | ||
// register a custom async-callback-based RDF parser | ||
jsonld.registerRDFParser = function(contentType, function(input, callback) { | ||
// parse input to a jsonld.js RDF dataset object... | ||
callback(err, dataset); | ||
}); | ||
// register a custom synchronous RDF parser | ||
jsonld.registerRDFParser = function(contentType, function(input) { | ||
// parse input to a jsonld.js RDF dataset object... and return it | ||
return dataset; | ||
}); | ||
// use the promises API | ||
@@ -128,2 +150,16 @@ var promises = jsonld.promises(); | ||
promise.then(function(normalized) {...}, function(err) {...}); | ||
// serialize to RDF | ||
var promise = promises.toRDF(doc, {format: 'application/nquads'}); | ||
promise.then(function(nquads) {...}, function(err) {...}); | ||
// deserialize from RDF | ||
var promise = promises.fromRDF(nquads, {format: 'application/nquads'}); | ||
promise.then(function(doc) {...}, function(err) {...}); | ||
// register a custom promise-based RDF parser | ||
jsonld.registerRDFParser = function(contentType, function(input) { | ||
// parse input into a jsonld.js RDF dataset object... | ||
return new Promise(...); | ||
}); | ||
``` | ||
@@ -130,0 +166,0 @@ |
Sorry, the diff of this file is too big to display
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
530213
13934
259