Comparing version 0.5.12 to 0.5.13
# jsonld ChangeLog | ||
## 0.5.13 - 2017-10-05 | ||
### Fixed | ||
- Remote context retrieval bug. | ||
### Removed | ||
- **BREAKING** Remove `promisify` API. | ||
## 0.5.12 - 2017-10-05 | ||
@@ -4,0 +12,0 @@ |
@@ -16,4 +16,9 @@ /* | ||
// find all URLs in the given document | ||
// find all URLs in the given document, reusing already retrieved URLs | ||
const urls = {}; | ||
Object.keys(_urls).forEach(function (url) { | ||
if (_urls[url] !== false) { | ||
urls[url] = _urls[url]; | ||
} | ||
}); | ||
_findContextUrls(doc, urls, false, options.base); | ||
@@ -94,2 +99,3 @@ | ||
// retrieve all @context URLs in input | ||
const _urls = {}; | ||
yield retrieve(input, {}, documentLoader); | ||
@@ -875,10 +881,12 @@ | ||
if (replace) { | ||
_ctx = urls[_ctx]; | ||
if (_isArray(_ctx)) { | ||
// add flattened context | ||
Array.prototype.splice.apply(ctx, [i, 1].concat(_ctx)); | ||
i += _ctx.length - 1; | ||
length = ctx.length; | ||
} else { | ||
ctx[i] = _ctx; | ||
if (urls[_ctx] !== false) { | ||
_ctx = urls[_ctx]; | ||
if (_isArray(_ctx)) { | ||
// add flattened context | ||
Array.prototype.splice.apply(ctx, [i, 1].concat(_ctx)); | ||
i += _ctx.length - 1; | ||
length = ctx.length; | ||
} else { | ||
ctx[i] = _ctx; | ||
} | ||
} | ||
@@ -896,3 +904,5 @@ } else if (!(_ctx in urls)) { | ||
if (replace) { | ||
input[key] = urls[ctx]; | ||
if (urls[ctx] !== false) { | ||
input[key] = urls[ctx]; | ||
} | ||
} else if (!(ctx in urls)) { | ||
@@ -899,0 +909,0 @@ // @context URL found |
@@ -442,23 +442,2 @@ /* | ||
// TODO: remove once Promise API is fixed | ||
/** | ||
* Converts a node.js async op into a promise w/boxed resolved value(s). | ||
* | ||
* @param op the operation to convert. | ||
* | ||
* @return the promise. | ||
*/ | ||
api.promisify = function (op) { | ||
const args = Array.prototype.slice.call(arguments, 1); | ||
return new Promise((resolve, reject) => { | ||
op.apply(null, args.concat((err, value) => { | ||
if (!err) { | ||
resolve(value); | ||
} else { | ||
reject(err); | ||
} | ||
})); | ||
}); | ||
}; | ||
function _invokeCallback(callback, err, result) { | ||
@@ -465,0 +444,0 @@ // execute on next tick to prevent "unhandled rejected promise" |
@@ -805,2 +805,3 @@ /* | ||
// retrieve all @context URLs in input | ||
const _urls = {}; | ||
await retrieve(input, {}, documentLoader); | ||
@@ -819,4 +820,9 @@ | ||
// find all URLs in the given document | ||
// find all URLs in the given document, reusing already retrieved URLs | ||
const urls = {}; | ||
Object.keys(_urls).forEach(url => { | ||
if(_urls[url] !== false) { | ||
urls[url] = _urls[url]; | ||
} | ||
}); | ||
_findContextUrls(doc, urls, false, options.base); | ||
@@ -940,10 +946,12 @@ | ||
if(replace) { | ||
_ctx = urls[_ctx]; | ||
if(_isArray(_ctx)) { | ||
// add flattened context | ||
Array.prototype.splice.apply(ctx, [i, 1].concat(_ctx)); | ||
i += _ctx.length - 1; | ||
length = ctx.length; | ||
} else { | ||
ctx[i] = _ctx; | ||
if(urls[_ctx] !== false) { | ||
_ctx = urls[_ctx]; | ||
if(_isArray(_ctx)) { | ||
// add flattened context | ||
Array.prototype.splice.apply(ctx, [i, 1].concat(_ctx)); | ||
i += _ctx.length - 1; | ||
length = ctx.length; | ||
} else { | ||
ctx[i] = _ctx; | ||
} | ||
} | ||
@@ -961,3 +969,5 @@ } else if(!(_ctx in urls)) { | ||
if(replace) { | ||
input[key] = urls[ctx]; | ||
if(urls[ctx] !== false) { | ||
input[key] = urls[ctx]; | ||
} | ||
} else if(!(ctx in urls)) { | ||
@@ -964,0 +974,0 @@ // @context URL found |
@@ -444,23 +444,2 @@ /* | ||
// TODO: remove once Promise API is fixed | ||
/** | ||
* Converts a node.js async op into a promise w/boxed resolved value(s). | ||
* | ||
* @param op the operation to convert. | ||
* | ||
* @return the promise. | ||
*/ | ||
api.promisify = function(op) { | ||
const args = Array.prototype.slice.call(arguments, 1); | ||
return new Promise((resolve, reject) => { | ||
op.apply(null, args.concat((err, value) => { | ||
if(!err) { | ||
resolve(value); | ||
} else { | ||
reject(err); | ||
} | ||
})); | ||
}); | ||
}; | ||
function _invokeCallback(callback, err, result) { | ||
@@ -467,0 +446,0 @@ // execute on next tick to prevent "unhandled rejected promise" |
{ | ||
"name": "jsonld", | ||
"version": "0.5.12", | ||
"version": "0.5.13", | ||
"description": "A JSON-LD Processor and API implementation in JavaScript.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/digitalbazaar/jsonld.js", |
Sorry, the diff of this file is too big to display
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
1080503
25485