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

jsona

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsona - npm Package Compare versions

Comparing version 1.1.12 to 1.1.13

19

lib/builders/ModelsSerializer.js

@@ -90,13 +90,18 @@ "use strict";

var relationLength = relation.length;
var uniqueRelationKeys = [];
for (var i = 0; i < relationLength; i++) {
var item = {
id: _this.propertiesMapper.getId(relation[i]),
type: _this.propertiesMapper.getType(relation[i])
};
if (item.id && item.type) {
relationshipData.push(item);
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 });
}
else {
else if (!item.id || !item.type) {
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);
}
}

@@ -103,0 +108,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.12",
"version": "1.1.13",
"keywords": [

@@ -6,0 +6,0 @@ "json-api",

@@ -133,12 +133,13 @@ import {

const relationLength = relation.length;
const uniqueRelationKeys = [];
for (let i = 0; i < relationLength; i++) {
const item = {
id: this.propertiesMapper.getId(relation[i]),
type: this.propertiesMapper.getType(relation[i])
};
const id = this.propertiesMapper.getId(relation[i]);
const type = this.propertiesMapper.getType(relation[i]);
const itemKey = type + id;
const item = {id, type};
if (item.id && item.type) {
relationshipData.push(item);
} else {
if (uniqueRelationKeys.indexOf(itemKey) !== -1) {
console.warn(`Duplicate relation model found`, { model, relations });
} else if (!item.id || !item.type) {
console.error(

@@ -149,2 +150,5 @@ `Can't create data item[${i}] for relationship ${k},

);
} else {
uniqueRelationKeys.push(itemKey);
relationshipData.push(item);
}

@@ -151,0 +155,0 @@ }

Sorry, the diff of this file is not supported yet

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