New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.7.1 to 0.7.2

6

dist/build.full.js

@@ -27,8 +27,8 @@ (function (global, factory) {

function defaultModelLookup({ property, model = property }) {
if (typeof model === 'function') {
const defaultModelLookup = ({ property, model = property }) => {
if ('function' === typeof model) {
return model;
}
return ModelsMap[model] || ModelsMap[property];
}
};
let modelLookup = defaultModelLookup;

@@ -35,0 +35,0 @@

@@ -23,8 +23,8 @@ import _Map from 'babel-runtime/core-js/map';

function defaultModelLookup({ property, model = property }) {
if (typeof model === 'function') {
const defaultModelLookup = ({ property, model = property }) => {
if ('function' === typeof model) {
return model;
}
return ModelsMap[model] || ModelsMap[property];
}
};
let modelLookup = defaultModelLookup;

@@ -31,0 +31,0 @@

@@ -5,6 +5,6 @@ import getModelSchema from './schema';

function defaultModelLookup({ property, model = property }) {
if (typeof model === 'function') { return model; }
const defaultModelLookup = ({ property, model = property }) => {
if ('function' === typeof model) { return model; }
return ModelsMap[model] || ModelsMap[property];
}
};
let modelLookup = defaultModelLookup;

@@ -11,0 +11,0 @@

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

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

@@ -1,4 +0,4 @@

# Decorators for creating model type structures with mobx
# Decorators for creating model relationships with mobx
mobx-decorated-models is a collection of es7 decorators to make a class observable and serializable.
mobx-decorated-models is a collection of Javascript decorators to make a classes and their relationships observable and serializable.

@@ -9,17 +9,14 @@ [![Build Status](https://travis-ci.org/nathanstitt/mobx-decorated-models.svg?branch=master)](https://travis-ci.org/nathanstitt/mobx-decorated-models)

[Mobx](https://mobx.js.org) makes state management super simple, but it doesn't offer an
opinion on how to get data in and out of the observed data structures.
This library is a collection of decorators that co-ordinates making
models relate to each other and their fields both observable and serializable.
It's built on top of two awesome libraries:
[Mobx](https://mobx.js.org) makes state management super simple, but it doesn't offer an opinion on how to get data in and out of the observed data structures.
[Serializr](https://github.com/mobxjs/serializr) takes care of that nicely.
Combining the two libraries isn’t difficult, but then you end up specifing each attribute twice;
once so Mobx will observe it, and once to create a schema for Serializr.
Combining the two libraries isn’t difficult, but then you end up specifing each attribute twice; once so Mobx will observe it, and once to create a schema for Serializr. Enter mobx-decorated-models.
This library is a collection of decorators that co-ordinates making
fields both observable and serializable.
While it’s at it, it also handles model lookups so different models can refer
to one another regardless of import order. When one model refers to another, a
reference of the requirement is stored and then later resolved when the class becomes known.
## Example

@@ -36,2 +33,3 @@

@field depth = 0;
@session tmpContents = 'a bunch of things'

@@ -58,3 +56,3 @@ @computed get volume() {

console.log(box.volume); // => 48
console.log(box.serialize()); // => { id: 1, width: 2, height: 3, depth: 8, items: [] }
console.log(box.serialize()); // => { id: 1, width: 2, height: 3, depth: 8, items: [] }; note `tmpContents` isn't serialized
```

@@ -61,0 +59,0 @@

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