Comparing version 1.1.13 to 1.1.14
@@ -90,18 +90,13 @@ "use strict"; | ||
var relationLength = relation.length; | ||
var uniqueRelationKeys = []; | ||
for (var i = 0; i < relationLength; i++) { | ||
var id = _this.propertiesMapper.getId(relation[i]); | ||
var type = _this.propertiesMapper.getType(relation[i]); | ||
var itemKey = type + id; | ||
var item = { id: id, type: type }; | ||
if (uniqueRelationKeys.indexOf(itemKey) !== -1) { | ||
console.warn("Duplicate relation model found", { model: model, relations: relations }); | ||
var item = { | ||
id: _this.propertiesMapper.getId(relation[i]), | ||
type: _this.propertiesMapper.getType(relation[i]) | ||
}; | ||
if (item.id && item.type) { | ||
relationshipData.push(item); | ||
} | ||
else if (!item.id || !item.type) { | ||
else { | ||
console.error("Can't create data item[" + i + "] for relationship " + k + ",\n it doesn't have 'id' or 'type', it was skipped", relation[i]); | ||
} | ||
else { | ||
uniqueRelationKeys.push(itemKey); | ||
relationshipData.push(item); | ||
} | ||
} | ||
@@ -108,0 +103,0 @@ relationships[k] = { |
{ | ||
"name": "jsona", | ||
"description": "Provide data formatters (data model builder & json builder) to work with JSON API specification v1.0 in your JavaScript / TypeScript code", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "json-api", |
@@ -133,13 +133,12 @@ import { | ||
const relationLength = relation.length; | ||
const uniqueRelationKeys = []; | ||
for (let i = 0; i < relationLength; i++) { | ||
const id = this.propertiesMapper.getId(relation[i]); | ||
const type = this.propertiesMapper.getType(relation[i]); | ||
const itemKey = type + id; | ||
const item = {id, type}; | ||
const item = { | ||
id: this.propertiesMapper.getId(relation[i]), | ||
type: this.propertiesMapper.getType(relation[i]) | ||
}; | ||
if (uniqueRelationKeys.indexOf(itemKey) !== -1) { | ||
console.warn(`Duplicate relation model found`, { model, relations }); | ||
} else if (!item.id || !item.type) { | ||
if (item.id && item.type) { | ||
relationshipData.push(item); | ||
} else { | ||
console.error( | ||
@@ -150,5 +149,2 @@ `Can't create data item[${i}] for relationship ${k}, | ||
); | ||
} else { | ||
uniqueRelationKeys.push(itemKey); | ||
relationshipData.push(item); | ||
} | ||
@@ -155,0 +151,0 @@ } |
Sorry, the diff of this file is not supported yet
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
126576
1995