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.11 to 1.1.12

1

lib/builders/JsonDeserializer.d.ts

@@ -6,3 +6,2 @@ import { IJsonPropertiesMapper, TJsonaModel, TJsonaRelationships, TJsonApiBody, TJsonApiData, IJsonaModelBuilder } from '../JsonaTypes';

protected includedInObject: any;
protected dataInObject: any;
protected cachedModels: {};

@@ -9,0 +8,0 @@ constructor(propertiesMapper: any);

5

lib/builders/JsonDeserializer.js

@@ -43,4 +43,7 @@ "use strict";

var model;
if (entityKey && Object.keys(data).length === 2) {
var onlyTypeIdInData = Object.keys(data).length === 2 && data.type && data.id;
if (entityKey && onlyTypeIdInData) {
// checks for built model in cachedModels is a protection from creating models on recursive relationships
// NOTE: onlyTypeIdInData need for prevent return empty, cached model (for collections with recursive relations)
// https://github.com/olosegres/jsona/issues/17
model = this.cachedModels[entityKey];

@@ -47,0 +50,0 @@ if (model) {

{
"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.11",
"version": "1.1.12",
"keywords": [

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

@@ -6,3 +6,3 @@ # Jsona

[![Build Status](https://travis-ci.org/olosegres/jsona.svg?branch=master)](https://travis-ci.org/olosegres/jsona)
[![dependencies](https://img.shields.io/gemnasium/mathiasbynens/he.svg)](https://www.npmjs.com/package/jsona/)
[![dependencies](https://camo.githubusercontent.com/cdc54d1641f5e11e246a2707063ecad092c96d11/68747470733a2f2f64617669642d646d2e6f72672f6477796c2f657374612e737667)](https://www.npmjs.com/package/jsona/)
[![downloads](https://img.shields.io/npm/dm/jsona.svg)](https://www.npmjs.com/package/jsona/)

@@ -9,0 +9,0 @@

@@ -23,3 +23,2 @@ import {

protected includedInObject;
protected dataInObject;
protected cachedModels = {};

@@ -64,3 +63,2 @@

buildModelByData(data: TJsonApiData): TJsonaModel {
const entityKey = createEntityKey(data);

@@ -70,4 +68,8 @@

if (entityKey && Object.keys(data).length === 2) {
const onlyTypeIdInData = Object.keys(data).length === 2 && data.type && data.id;
if (entityKey && onlyTypeIdInData) {
// checks for built model in cachedModels is a protection from creating models on recursive relationships
// NOTE: onlyTypeIdInData need for prevent return empty, cached model (for collections with recursive relations)
// https://github.com/olosegres/jsona/issues/17
model = this.cachedModels[entityKey];

@@ -74,0 +76,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