New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mobx-state-tree

Package Overview
Dependencies
Maintainers
2
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-state-tree - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

16

changelog.md

@@ -0,1 +1,17 @@

# 0.5.1
* Introduced support for lazy evaluating values in `withDefault`, useful to generate UUID's, timestamps or non-primitive default values
* It is now possible to define something like
```javascript
const Box = types.model({
point: {
x: 10,
y: 10
}
}
```
Where the type of `point` property is inferred to `point: types.withDefault(types.model({ x: 10, y: 10}), () => ({ x: 10, y: 10 }))`
# 0.5.0

@@ -2,0 +18,0 @@

3

lib/index.d.ts

@@ -7,3 +7,2 @@ import "./types/type";

export { isMST, getType, getChildType, onAction, applyAction } from "./core";
export { asReduxStore, IReduxStore } from "./interop/redux";
export { connectReduxDevtools } from "./interop/redux-devtools";
export { asReduxStore, IReduxStore, connectReduxDevtools } from "./interop/redux";

@@ -21,4 +21,3 @@ "use strict";

exports.asReduxStore = redux_1.asReduxStore;
var redux_devtools_1 = require("./interop/redux-devtools");
exports.connectReduxDevtools = redux_devtools_1.connectReduxDevtools;
exports.connectReduxDevtools = redux_1.connectReduxDevtools;
//# sourceMappingURL=index.js.map

@@ -11,1 +11,2 @@ import { IRawActionCall } from "../core";

export declare function asReduxStore(model: any, ...middlewares: MiddleWare[]): IReduxStore;
export declare function connectReduxDevtools(remoteDevDep: any, model: any): void;

@@ -5,2 +5,3 @@ "use strict";

var mst_operations_1 = require("../core/mst-operations");
var action_1 = require("../core/action");
var utils_1 = require("../utils");

@@ -16,5 +17,3 @@ function asReduxStore(model) {

dispatch: function (action) {
// TODO: reimplement redux middleware
utils_1.fail("Not implemented");
// runMiddleWare(action, runners.slice(), (newAction: any) => applyAction(model, reduxActionToAction(newAction)))
runMiddleWare(action, runners.slice(), function (newAction) { return action_1.applyAction(model, reduxActionToAction(newAction)); });
},

@@ -45,2 +44,28 @@ subscribe: function (listener) { return mst_operations_1.onSnapshot(model, listener); }

}
function connectReduxDevtools(remoteDevDep, model) {
// Connect to the monitor
var remotedev = remoteDevDep.connectViaExtension();
var applyingSnapshot = false;
// Subscribe to change state (if need more than just logging)
remotedev.subscribe(function (message) {
// Helper when only time travelling needed
var state = remoteDevDep.extractState(message);
if (state) {
applyingSnapshot = true;
mst_operations_1.applySnapshot(model, state);
applyingSnapshot = false;
}
});
// Send changes to the remote monitor
action_1.onAction(model, function (action) {
if (applyingSnapshot)
return;
var copy = {};
copy.type = action.name;
if (action.args)
action.args.forEach(function (value, index) { return copy[index] = value; });
remotedev.send(copy, mst_operations_1.getSnapshot(model));
});
}
exports.connectReduxDevtools = connectReduxDevtools;
//# sourceMappingURL=redux.js.map

@@ -6,3 +6,3 @@ import { IObservableArray, IArrayWillChange, IArrayWillSplice, IArrayChange, IArraySplice } from "mobx";

export declare function arrayToString(this: IObservableArray<any>): string;
export declare class ArrayType<T> extends ComplexType<T[], IObservableArray<T>> {
export declare class ArrayType<S, T> extends ComplexType<S[], IObservableArray<T>> {
isArrayFactory: boolean;

@@ -9,0 +9,0 @@ subType: IType<any, any>;

@@ -79,3 +79,3 @@ "use strict";

var _a = this, baseModel = _a.baseModel, baseActions = _a.baseActions;
for (var key in baseModel)
var _loop_1 = function (key) {
if (utils_1.hasOwnProperty(baseModel, key)) {

@@ -85,29 +85,35 @@ // TODO: check that hooks are not defined as part of baseModel

if ("get" in descriptor) {
this.props[key] = new computed_property_1.ComputedProperty(key, descriptor.get, descriptor.set);
continue;
this_1.props[key] = new computed_property_1.ComputedProperty(key, descriptor.get, descriptor.set);
return "continue";
}
var value = descriptor.value;
if (value === null || undefined) {
var value_1 = descriptor.value;
if (value_1 === null || undefined) {
utils_1.fail("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");
}
else if (identifier_1.isIdentifierFactory(value)) {
utils_1.invariant(!this.identifierAttribute, "Cannot define property '" + key + "' as object identifier, property '" + this.identifierAttribute + "' is already defined as identifier property");
this.identifierAttribute = key;
this.props[key] = new identifier_property_1.IdentifierProperty(key);
else if (identifier_1.isIdentifierFactory(value_1)) {
utils_1.invariant(!this_1.identifierAttribute, "Cannot define property '" + key + "' as object identifier, property '" + this_1.identifierAttribute + "' is already defined as identifier property");
this_1.identifierAttribute = key;
this_1.props[key] = new identifier_property_1.IdentifierProperty(key);
}
else if (utils_1.isPrimitive(value)) {
var baseType = primitives_1.getPrimitiveFactoryFromValue(value);
this.props[key] = new value_property_1.ValueProperty(key, with_default_1.createDefaultValueFactory(baseType, value));
else if (utils_1.isPrimitive(value_1)) {
var baseType = primitives_1.getPrimitiveFactoryFromValue(value_1);
this_1.props[key] = new value_property_1.ValueProperty(key, with_default_1.createDefaultValueFactory(baseType, value_1));
}
else if (type_1.isType(value)) {
this.props[key] = new value_property_1.ValueProperty(key, value);
else if (type_1.isType(value_1)) {
this_1.props[key] = new value_property_1.ValueProperty(key, value_1);
}
else if (reference_1.isReferenceFactory(value)) {
this.props[key] = new reference_property_1.ReferenceProperty(key, value.targetType, value.basePath);
else if (reference_1.isReferenceFactory(value_1)) {
this_1.props[key] = new reference_property_1.ReferenceProperty(key, value_1.targetType, value_1.basePath);
}
else if (typeof value === "function") {
this.props[key] = new view_property_1.ViewProperty(key, value);
else if (typeof value_1 === "function") {
this_1.props[key] = new view_property_1.ViewProperty(key, value_1);
}
else if (typeof value === "object") {
utils_1.fail("In property '" + key + "': base model's should not contain complex values: '" + value + "'");
else if (typeof value_1 === "object") {
if (!Array.isArray(value_1) && utils_1.isPlainObject(value_1)) {
this_1.props[key] = new value_property_1.ValueProperty(key, with_default_1.createDefaultValueFactory(createModelFactory(this_1.name + "__" + key, value_1), function () { return value_1; }));
}
else {
// TODO: in future also expand on `[Type]` and `[{ x: 3 }]`
utils_1.fail("In property '" + key + "': base model's should not contain complex values: '" + value_1 + "'");
}
}

@@ -118,2 +124,7 @@ else {

}
};
var this_1 = this;
for (var key in baseModel) {
_loop_1(key);
}
for (var key in baseActions)

@@ -120,0 +131,0 @@ if (utils_1.hasOwnProperty(baseActions, key)) {

@@ -38,4 +38,6 @@ import { IObservableArray } from "mobx";

withDefault: {
<T>(type: IType<T, T>, defaultValueOrNode: T): IType<T, T>;
<S, T>(type: IType<S, T>, defaultValueOrNode: S): IType<S, T>;
<S, T>(type: IType<S, T>, defaultValueOrFunction: S): IType<S, T>;
<S, T>(type: IType<S, T>, defaultValueOrFunction: T): IType<S, T>;
<S, T>(type: IType<S, T>, defaultValueOrFunction: () => S): IType<S, T>;
<S, T>(type: IType<S, T>, defaultValueOrFunction: () => T): IType<S, T>;
};

@@ -42,0 +44,0 @@ literal: <S>(value: S) => ISimpleType<S>;

import { Type, IType } from "../type";
export declare type IFunctionReturn<T> = () => T;
export declare type IDefaultValue<S, T> = S | T | IFunctionReturn<S> | IFunctionReturn<T>;
export declare class DefaultValue<S, T> extends Type<S, T> {
readonly type: IType<S, T>;
readonly defaultValue: any;
constructor(type: IType<S, T>, defaultValue: S);
readonly defaultValue: IDefaultValue<S, T>;
constructor(type: IType<S, T>, defaultValue: IDefaultValue<S, T>);
describe(): string;

@@ -10,3 +12,5 @@ create(value: any): T;

}
export declare function createDefaultValueFactory<T>(type: IType<T, T>, defaultValueOrNode: T): IType<T, T>;
export declare function createDefaultValueFactory<S, T>(type: IType<S, T>, defaultValueOrNode: S): IType<S, T>;
export declare function createDefaultValueFactory<S, T>(type: IType<S, T>, defaultValueOrFunction: S): IType<S, T>;
export declare function createDefaultValueFactory<S, T>(type: IType<S, T>, defaultValueOrFunction: T): IType<S, T>;
export declare function createDefaultValueFactory<S, T>(type: IType<S, T>, defaultValueOrFunction: () => S): IType<S, T>;
export declare function createDefaultValueFactory<S, T>(type: IType<S, T>, defaultValueOrFunction: () => T): IType<S, T>;

@@ -28,3 +28,8 @@ "use strict";

DefaultValue.prototype.create = function (value) {
return typeof value === "undefined" ? this.type.create(this.defaultValue) : this.type.create(value);
if (typeof value === "undefined") {
var defaultValue = typeof this.defaultValue === "function" ? this.defaultValue() : this.defaultValue;
var defaultSnapshot = mst_node_1.isMST(defaultValue) ? mst_node_1.getMSTAdministration(defaultValue).snapshot : defaultValue;
return this.type.create(defaultSnapshot);
}
return this.type.create(value);
};

@@ -38,6 +43,7 @@ DefaultValue.prototype.is = function (value) {

exports.DefaultValue = DefaultValue;
function createDefaultValueFactory(type, defaultValueOrNode) {
var defaultValue = mst_node_1.isMST(defaultValueOrNode) ? mst_node_1.getMSTAdministration(defaultValueOrNode).snapshot : defaultValueOrNode;
type_1.typecheck(type, defaultValue);
return new DefaultValue(type, defaultValue);
function createDefaultValueFactory(type, defaultValueOrFunction) {
var defaultValue = typeof defaultValueOrFunction === "function" ? defaultValueOrFunction() : defaultValueOrFunction;
var defaultSnapshot = mst_node_1.isMST(defaultValue) ? mst_node_1.getMSTAdministration(defaultValue).snapshot : defaultValue;
type_1.typecheck(type, defaultSnapshot);
return new DefaultValue(type, defaultValueOrFunction);
}

@@ -44,0 +50,0 @@ exports.createDefaultValueFactory = createDefaultValueFactory;

{
"name": "mobx-state-tree",
"version": "0.5.0",
"version": "0.5.1",
"description": "Opinionated, transactional, MobX powered state container",

@@ -16,3 +16,3 @@ "main": "lib/index.js",

"coverage": "npm run build-tests && nyc ava && nyc report -r html && nyc report -r lcov",
"build-docs": "npm run quick-build && documentation readme lib/index.js --github --section API",
"build-docs": "npm run quick-build && documentation build lib/index.js --github -f md -o API.md",
"lint": "tslint -c tslint.json 'src/**/*.ts'",

@@ -47,5 +47,3 @@ "clean": "rm -rf lib test-lib .nyc_output coverage"

},
"dependencies": {
"remotedev": "^0.2.2"
},
"dependencies": {},
"peerDependencies": {

@@ -52,0 +50,0 @@ "mobx": "^3.1.9"

@@ -11,2 +11,5 @@ # mobx-state-tree

* [Api Docs](API.md)
* [Changelog](changelog.md)
An introduction to the philosophy can be watched [here](https://youtu.be/ta8QKmNRXZM?t=21m52s). [Slides](https://immer-mutable-state.surge.sh/). Or, as [markdown](https://github.com/mweststrate/reactive2016-slides/blob/master/slides.md) to read it quickly.

@@ -326,358 +329,2 @@

# API
## maybeMST
[lib/core/mst-node.js:28-40](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-node.js#L28-L40 "Source code on GitHub")
Tries to convert a value to a TreeNode. If possible or already done,
the first callback is invoked, otherwise the second.
The result of this function is the return value of the callbacks, or the original value if the second callback is omitted
**Parameters**
- `value`
- `asNodeCb`
- `asPrimitiveCb`
## ComplexType
[lib/types/complex-types/complex-type.js:18-53](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/types/complex-types/complex-type.js#L18-L53 "Source code on GitHub")
A complex type produces a MST node (Node in the state tree)
## get
[lib/core/mst-node-administration.js:51-55](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-node-administration.js#L51-L55 "Source code on GitHub")
Returnes (escaped) path representation as string
## pseudoAction
[lib/core/mst-node-administration.js:316-321](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-node-administration.js#L316-L321 "Source code on GitHub")
Pseudo action is an action that is not named, does not trigger middleware but does unlock the tree.
Used for applying (initial) snapshots and patches
**Parameters**
- `fn`
## map
[lib/types/index.js:24-26](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/types/index.js#L24-L26 "Source code on GitHub")
**Parameters**
- `subFactory` **\[ModelFactory]** (optional, default `primitiveFactory`)
## array
[lib/types/index.js:34-36](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/types/index.js#L34-L36 "Source code on GitHub")
**Parameters**
- `subFactory` **\[ModelFactory]** (optional, default `primitiveFactory`)
## props
[lib/types/complex-types/object.js:45-45](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/types/complex-types/object.js#L45-L45 "Source code on GitHub")
Parsed description of all properties
## addMiddleware
[lib/core/mst-operations.js:50-55](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L50-L55 "Source code on GitHub")
TODO: update docs
Registers middleware on a model instance that is invoked whenever one of it's actions is called, or an action on one of it's children.
Will only be invoked on 'root' actions, not on actions called from existing actions.
The callback receives two parameter: the `action` parameter describes the action being invoked. The `next()` function can be used
to kick off the next middleware in the chain. Not invoking `next()` prevents the action from actually being executed!
Action calls have the following signature:
export type IActionCall = {
name: string;
path?: string;
args?: any[];
}
Example of a logging middleware:
function logger(action, next) {
console.dir(action)
return next()
}
onAction(myStore, logger)
myStore.user.setAge(17)
// emits:
{
name: "setAge"
path: "/user",
args: [17]
}
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** model to intercept actions on
- `middleware`
Returns **IDisposer** function to remove the middleware
## onPatch
[lib/core/mst-operations.js:67-69](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L67-L69 "Source code on GitHub")
Registers a function that will be invoked for each that as made to the provided model instance, or any of it's children.
See 'patches' for more details. onPatch events are emitted immediately and will not await the end of a transaction.
Patches can be used to deep observe a model tree.
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the model instance from which to receive patches
- `callback`
Returns **IDisposer** function to remove the listener
## applyPatch
[lib/core/mst-operations.js:83-85](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L83-L85 "Source code on GitHub")
Applies a JSON-patch to the given model instance or bails out if the patch couldn't be applied
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `patch` **IJsonPatch**
## applyPatches
[lib/core/mst-operations.js:94-99](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L94-L99 "Source code on GitHub")
Applies a number of JSON patches in a single MobX transaction
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `patches` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;IJsonPatch>**
## applyActions
[lib/core/mst-operations.js:125-129](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L125-L129 "Source code on GitHub")
Applies a series of actions in a single MobX transaction.
Does not return any value
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `actions` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;IActionCall>**
- `options` **\[IActionCallOptions]**
## protect
[lib/core/mst-operations.js:163-165](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L163-L165 "Source code on GitHub")
By default it is allowed to both directly modify a model or through an action.
However, in some cases you want to guarantee that the state tree is only modified through actions.
So that replaying action will reflect everything that can possible have happened to your objects, or that every mutation passes through your action middleware etc.
To disable modifying data in the tree without action, simple call `protect(model)`. Protect protects the passed model an all it's children
**Parameters**
- `target`
**Examples**
```javascript
const Todo = types.model({
done: false,
toggle() {
this.done = !this.done
}
})
const todo = new Todo()
todo.done = true // OK
protect(todo)
todo.done = false // throws!
todo.toggle() // OK
```
## isProtected
[lib/core/mst-operations.js:174-176](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L174-L176 "Source code on GitHub")
Returns true if the object is in protected mode, @see protect
**Parameters**
- `target`
## applySnapshot
[lib/core/mst-operations.js:186-188](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L186-L188 "Source code on GitHub")
Applies a snapshot to a given model instances. Patch and snapshot listeners will be invoked as usual.
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `snapshot` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
## hasParent
[lib/core/mst-operations.js:202-212](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L202-L212 "Source code on GitHub")
Given a model instance, returns `true` if the object has a parent, that is, is part of another object, map or array
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `depth` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** = 1, how far should we look upward?
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
## getPath
[lib/core/mst-operations.js:238-240](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L238-L240 "Source code on GitHub")
Returns the path of the given object in the model tree
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
## getPathParts
[lib/core/mst-operations.js:249-251](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L249-L251 "Source code on GitHub")
Returns the path of the given object as unescaped string array
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>**
## isRoot
[lib/core/mst-operations.js:260-262](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L260-L262 "Source code on GitHub")
Returns true if the given object is the root of a model tree
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
## resolve
[lib/core/mst-operations.js:272-276](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L272-L276 "Source code on GitHub")
Resolves a path relatively to a given object.
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `path` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** escaped json path
Returns **Any**
## tryResolve
[lib/core/mst-operations.js:286-291](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L286-L291 "Source code on GitHub")
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `path` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**
Returns **Any**
## clone
[lib/core/mst-operations.js:305-314](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L305-L314 "Source code on GitHub")
**Parameters**
- `source` **T**
- `keepEnvironment`
Returns **T**
## detach
[lib/core/mst-operations.js:319-322](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L319-L322 "Source code on GitHub")
Removes a model element from the state tree, and let it live on as a new state tree
**Parameters**
- `thing`
## destroy
[lib/core/mst-operations.js:327-333](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L327-L333 "Source code on GitHub")
Removes a model element from the state tree, and mark it as end-of-life; the element should not be used anymore
**Parameters**
- `thing`
## walk
[lib/core/mst-operations.js:353-361](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/mst-operations.js#L353-L361 "Source code on GitHub")
Performs a depth first walk through a tree
**Parameters**
- `thing`
- `processor`
## applyAction
[lib/core/action.js:107-114](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/action.js#L107-L114 "Source code on GitHub")
Dispatches an Action on a model instance. All middlewares will be triggered.
Returns the value of the last actoin
**Parameters**
- `target` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `action` **IActionCall**
- `options` **\[IActionCallOptions]**
## escapeJsonPath
[lib/core/json-patch.js:9-11](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/json-patch.js#L9-L11 "Source code on GitHub")
escape slashes and backslashes
<http://tools.ietf.org/html/rfc6901>
**Parameters**
- `str`
## unescapeJsonPath
[lib/core/json-patch.js:16-18](https://github.com/mweststrate/mobx-state-tree/blob/abcd0210045bbf48f3ea094b030495549d0ec481/lib/core/json-patch.js#L16-L18 "Source code on GitHub")
unescape slashes and backslashes
**Parameters**
- `str`
# FAQ

@@ -743,1 +390,6 @@

```
## Circular dependencies:
`types.late(() => require("./OtherType"))`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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