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

mobx-decorated-models

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-decorated-models - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

8

dist/build.full.js

@@ -121,4 +121,7 @@ (function (global, factory) {

var AsyncHandlers = {
hasMany: function hasMany(modelRef) {
return serializr.list(serializr.object(modelRef));
hasMany: function hasMany(modelKlass) {
var defaultSerializer = serializr.list(serializr.object(modelKlass));
return Object.assign(defaultSerializer, {
model: modelKlass
});
},

@@ -128,2 +131,3 @@ belongsTo: function belongsTo(modelKlass, options, propName) {

return {
model: modelKlass,
deserializer: function deserializer(value, cb, context) {

@@ -130,0 +134,0 @@ defaultSerializer.deserializer(value, function (err, model) {

@@ -118,4 +118,7 @@ import { createModelSchema, deserialize, getDefaultModelSchema, identifier, list, object, primitive, serialize, update } from 'serializr';

var AsyncHandlers = {
hasMany: function hasMany(modelRef) {
return list(object(modelRef));
hasMany: function hasMany(modelKlass) {
var defaultSerializer = list(object(modelKlass));
return Object.assign(defaultSerializer, {
model: modelKlass
});
},

@@ -125,2 +128,3 @@ belongsTo: function belongsTo(modelKlass, options, propName) {

return {
model: modelKlass,
deserializer: function deserializer(value, cb, context) {

@@ -127,0 +131,0 @@ defaultSerializer.deserializer(value, function (err, model) {

@@ -58,6 +58,13 @@ import {

const AsyncHandlers = {
hasMany: modelRef => list(object(modelRef)),
belongsTo: (modelKlass, options, propName) => {
hasMany(modelKlass) {
const defaultSerializer = list(object(modelKlass));
return Object.assign(defaultSerializer, {
model: modelKlass,
});
},
belongsTo(modelKlass, options, propName) {
const defaultSerializer = object(getDefaultModelSchema(modelKlass));
return {
model: modelKlass,
deserializer(value, cb, context) {

@@ -64,0 +71,0 @@ defaultSerializer.deserializer(value, (err, model) => {

{
"name": "mobx-decorated-models",
"version": "0.3.2",
"version": "0.3.3",
"description": "Decorators to make using Mobx for model type structures easier",

@@ -5,0 +5,0 @@ "main": "dist/build.full.js",

@@ -47,2 +47,4 @@ import { Container, Box } from './test-models';

);
expect(box.metadata.one).toEqual(1);
expect(box.metadata.four.test).toBe(true);
});

@@ -66,2 +68,3 @@

box.update({ id: 32, width: 3, depth: 12, height: 4, container });
expect(box.container).toBeInstanceOf(Container);
expect(box.serialize()).toEqual({

@@ -68,0 +71,0 @@ container: {

Sorry, the diff of this file is not supported yet

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