Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonld

Package Overview
Dependencies
Maintainers
3
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonld - npm Package Compare versions

Comparing version 0.1.19 to 0.1.20

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc