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

jsonld

Package Overview
Dependencies
Maintainers
4
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.5.13 to 0.5.14

6

CHANGELOG.md
# jsonld ChangeLog
## 0.5.14 - 2017-10-11
### Fixed
- Allow empty lists to be compacted to any @list container term. Fixes
compact-0074 test.
## 0.5.13 - 2017-10-05

@@ -4,0 +10,0 @@

81

dist/node6/lib/compact.js

@@ -418,44 +418,51 @@ /*

const list = value['@list'];
let commonLanguage = list.length === 0 ? defaultLanguage : null;
let commonType = null;
for (let i = 0; i < list.length; ++i) {
const item = list[i];
let itemLanguage = '@none';
let itemType = '@none';
if (_isValue(item)) {
if ('@language' in item) {
itemLanguage = item['@language'];
} else if ('@type' in item) {
itemType = item['@type'];
if (list.length === 0) {
// any empty list can be matched against any term that uses the
// @list container regardless of @type or @language
typeOrLanguage = '@any';
typeOrLanguageValue = '@none';
} else {
let commonLanguage = list.length === 0 ? defaultLanguage : null;
let commonType = null;
for (let i = 0; i < list.length; ++i) {
const item = list[i];
let itemLanguage = '@none';
let itemType = '@none';
if (_isValue(item)) {
if ('@language' in item) {
itemLanguage = item['@language'];
} else if ('@type' in item) {
itemType = item['@type'];
} else {
// plain literal
itemLanguage = '@null';
}
} else {
// plain literal
itemLanguage = '@null';
itemType = '@id';
}
if (commonLanguage === null) {
commonLanguage = itemLanguage;
} else if (itemLanguage !== commonLanguage && _isValue(item)) {
commonLanguage = '@none';
}
if (commonType === null) {
commonType = itemType;
} else if (itemType !== commonType) {
commonType = '@none';
}
// there are different languages and types in the list, so choose
// the most generic term, no need to keep iterating the list
if (commonLanguage === '@none' && commonType === '@none') {
break;
}
}
commonLanguage = commonLanguage || '@none';
commonType = commonType || '@none';
if (commonType !== '@none') {
typeOrLanguage = '@type';
typeOrLanguageValue = commonType;
} else {
itemType = '@id';
typeOrLanguageValue = commonLanguage;
}
if (commonLanguage === null) {
commonLanguage = itemLanguage;
} else if (itemLanguage !== commonLanguage && _isValue(item)) {
commonLanguage = '@none';
}
if (commonType === null) {
commonType = itemType;
} else if (itemType !== commonType) {
commonType = '@none';
}
// there are different languages and types in the list, so choose
// the most generic term, no need to keep iterating the list
if (commonLanguage === '@none' && commonType === '@none') {
break;
}
}
commonLanguage = commonLanguage || '@none';
commonType = commonType || '@none';
if (commonType !== '@none') {
typeOrLanguage = '@type';
typeOrLanguageValue = commonType;
} else {
typeOrLanguageValue = commonLanguage;
}
} else {

@@ -462,0 +469,0 @@ if (_isValue(value)) {

@@ -644,6 +644,8 @@ /*

'@language': {},
'@type': {}
'@type': {},
'@any': {}
};
}
entry = entry[container];
_addPreferredTerm(term, entry['@any'], '@none');

@@ -650,0 +652,0 @@ if (mapping.reverse) {

@@ -435,44 +435,51 @@ /*

const list = value['@list'];
let commonLanguage = (list.length === 0) ? defaultLanguage : null;
let commonType = null;
for(let i = 0; i < list.length; ++i) {
const item = list[i];
let itemLanguage = '@none';
let itemType = '@none';
if(_isValue(item)) {
if('@language' in item) {
itemLanguage = item['@language'];
} else if('@type' in item) {
itemType = item['@type'];
if(list.length === 0) {
// any empty list can be matched against any term that uses the
// @list container regardless of @type or @language
typeOrLanguage = '@any';
typeOrLanguageValue = '@none';
} else {
let commonLanguage = (list.length === 0) ? defaultLanguage : null;
let commonType = null;
for(let i = 0; i < list.length; ++i) {
const item = list[i];
let itemLanguage = '@none';
let itemType = '@none';
if(_isValue(item)) {
if('@language' in item) {
itemLanguage = item['@language'];
} else if('@type' in item) {
itemType = item['@type'];
} else {
// plain literal
itemLanguage = '@null';
}
} else {
// plain literal
itemLanguage = '@null';
itemType = '@id';
}
if(commonLanguage === null) {
commonLanguage = itemLanguage;
} else if(itemLanguage !== commonLanguage && _isValue(item)) {
commonLanguage = '@none';
}
if(commonType === null) {
commonType = itemType;
} else if(itemType !== commonType) {
commonType = '@none';
}
// there are different languages and types in the list, so choose
// the most generic term, no need to keep iterating the list
if(commonLanguage === '@none' && commonType === '@none') {
break;
}
}
commonLanguage = commonLanguage || '@none';
commonType = commonType || '@none';
if(commonType !== '@none') {
typeOrLanguage = '@type';
typeOrLanguageValue = commonType;
} else {
itemType = '@id';
typeOrLanguageValue = commonLanguage;
}
if(commonLanguage === null) {
commonLanguage = itemLanguage;
} else if(itemLanguage !== commonLanguage && _isValue(item)) {
commonLanguage = '@none';
}
if(commonType === null) {
commonType = itemType;
} else if(itemType !== commonType) {
commonType = '@none';
}
// there are different languages and types in the list, so choose
// the most generic term, no need to keep iterating the list
if(commonLanguage === '@none' && commonType === '@none') {
break;
}
}
commonLanguage = commonLanguage || '@none';
commonType = commonType || '@none';
if(commonType !== '@none') {
typeOrLanguage = '@type';
typeOrLanguageValue = commonType;
} else {
typeOrLanguageValue = commonLanguage;
}
} else {

@@ -479,0 +486,0 @@ if(_isValue(value)) {

@@ -604,6 +604,8 @@ /*

'@language': {},
'@type': {}
'@type': {},
'@any': {}
};
}
entry = entry[container];
_addPreferredTerm(term, entry['@any'], '@none');

@@ -610,0 +612,0 @@ if(mapping.reverse) {

@@ -115,3 +115,3 @@ /*

if(rel.path !== '') {
// remove slashes and dots in path
// remove slashes and dots in path
transform.path = api.removeDotSegments(transform.path);

@@ -118,0 +118,0 @@ }

{
"name": "jsonld",
"version": "0.5.13",
"version": "0.5.14",
"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

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