Comparing version 2.0.0 to 2.0.1
# jsonld ChangeLog | ||
## 2.0.1 - 2019-12-10 | ||
### Fixed | ||
- JSON literal value handling issues. | ||
## 2.0.0 - 2019-12-09 | ||
@@ -4,0 +9,0 @@ |
@@ -460,2 +460,3 @@ /* | ||
const nests = []; | ||
let unexpandedValue; | ||
@@ -574,2 +575,6 @@ for (const key of keys) { | ||
if (expandedProperty === '@value') { | ||
// capture value for later | ||
// "colliding keywords" check prevents this from being set twice | ||
unexpandedValue = value; | ||
_addValue(expandedParent, '@value', value, { | ||
@@ -850,9 +855,7 @@ propertyIsArray: options.isFrame | ||
} // add value for property | ||
// use an array except for certain keywords | ||
// special keywords handled above | ||
const useArray = !['@index', '@id', '@type', '@value', '@language'].includes(expandedProperty); | ||
_addValue(expandedParent, expandedProperty, expandedValue, { | ||
propertyIsArray: useArray | ||
propertyIsArray: true | ||
}); | ||
@@ -863,11 +866,9 @@ } // @value must not be an object or an array (unless framing) or if @type is | ||
if ('@value' in element) { | ||
const value = element['@value']; | ||
if (element['@type'] === '@json' && _processingMode(activeCtx, 1.1)) {// allow any value, to be verified when the object is fully expanded and | ||
if ('@value' in expandedParent) { | ||
if (expandedParent['@type'] === '@json' && _processingMode(activeCtx, 1.1)) {// allow any value, to be verified when the object is fully expanded and | ||
// the @type is @json. | ||
} else if ((_isObject(value) || _isArray(value)) && !options.isFrame) { | ||
} else if ((_isObject(unexpandedValue) || _isArray(unexpandedValue)) && !options.isFrame) { | ||
throw new JsonLdError('Invalid JSON-LD syntax; "@value" value must not be an ' + 'object or an array.', 'jsonld.SyntaxError', { | ||
code: 'invalid value object value', | ||
value | ||
value: unexpandedValue | ||
}); | ||
@@ -874,0 +875,0 @@ } |
@@ -409,2 +409,3 @@ /* | ||
const nests = []; | ||
let unexpandedValue; | ||
for(const key of keys) { | ||
@@ -517,2 +518,5 @@ let value = element[key]; | ||
if(expandedProperty === '@value') { | ||
// capture value for later | ||
// "colliding keywords" check prevents this from being set twice | ||
unexpandedValue = value; | ||
_addValue( | ||
@@ -763,8 +767,5 @@ expandedParent, '@value', value, {propertyIsArray: options.isFrame}); | ||
// add value for property | ||
// use an array except for certain keywords | ||
const useArray = | ||
!['@index', '@id', '@type', '@value', '@language'] | ||
.includes(expandedProperty); | ||
// special keywords handled above | ||
_addValue(expandedParent, expandedProperty, expandedValue, { | ||
propertyIsArray: useArray | ||
propertyIsArray: true | ||
}); | ||
@@ -775,8 +776,8 @@ } | ||
// @json | ||
if('@value' in element) { | ||
const value = element['@value']; | ||
if(element['@type'] === '@json' && _processingMode(activeCtx, 1.1)) { | ||
if('@value' in expandedParent) { | ||
if(expandedParent['@type'] === '@json' && _processingMode(activeCtx, 1.1)) { | ||
// allow any value, to be verified when the object is fully expanded and | ||
// the @type is @json. | ||
} else if((_isObject(value) || _isArray(value)) && !options.isFrame) { | ||
} else if((_isObject(unexpandedValue) || _isArray(unexpandedValue)) && | ||
!options.isFrame) { | ||
throw new JsonLdError( | ||
@@ -786,3 +787,3 @@ 'Invalid JSON-LD syntax; "@value" value must not be an ' + | ||
'jsonld.SyntaxError', | ||
{code: 'invalid value object value', value}); | ||
{code: 'invalid value object value', value: unexpandedValue}); | ||
} | ||
@@ -789,0 +790,0 @@ } |
{ | ||
"name": "jsonld", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"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
1567000
18983