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.0.50 to 0.0.51

71

js/request.js

@@ -102,21 +102,36 @@ /**

// input is RDFa
jsdom.env(data, function(errors, window) {
if(errors && errors.length > 0) {
return callback({
message: 'DOM Errors:',
errors: errors,
url: loc
});
}
try {
jsdom.env(data, function(errors, window) {
if(errors && errors.length > 0) {
return callback({
message: 'DOM Errors:',
errors: errors,
url: loc
});
}
try {
// extract JSON-LD from RDFa
RDFa.attach(window.document);
jsonld.fromRDF(window.document.data,
{format: 'rdfa-api'}, callback);
}
catch(ex) {
callback(ex);
}
});
try {
// extract JSON-LD from RDFa
RDFa.attach(window.document);
jsonld.fromRDF(window.document.data,
{format: 'rdfa-api'}, callback);
}
catch(ex) {
// FIXME: expose RDFa/jsonld ex?
callback({
message: 'RDFa extraction error.',
contentType: type,
url: loc
});
}
});
}
catch(ex) {
// FIXME: expose jsdom(?) ex?
callback({
message: 'jsdom error.',
contentType: type,
url: loc
});
}
break;

@@ -255,7 +270,21 @@ default:

if(!(res.statusCode >= 200 && res.statusCode < 300)) {
return callback({
var msg = {
message: 'Bad status code.',
statusCode: res.statusCode,
url: loc
});
url: loc,
};
if(body) {
// attempt to auto-parse error body
return _parse(loc, null, body, function(err, data) {
if(err) {
// failed to parse, just use raw body
data = body
}
msg.body = data
callback(msg);
});
}
else {
return callback(msg);
}
}

@@ -262,0 +291,0 @@ // done if length specified and is 0

{
"name": "jsonld",
"version": "0.0.50",
"version": "0.0.51",
"description": "A JSON-LD Processor and API implementation in JavaScript.",

@@ -29,3 +29,3 @@ "homepage": "http://github.com/digitalbazaar/jsonld.js",

"pkginfo": "~0.2.3",
"request": "~2.16.0",
"request": "git://github.com/mikeal/request.git",
"xmldom": ""

@@ -32,0 +32,0 @@ },

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