mobx-state-tree 5.0.5 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/mobx-state-tree.js +14 -17
- package/dist/mobx-state-tree.min.js +1 -1
- package/dist/mobx-state-tree.module.js +14 -17
- package/dist/mobx-state-tree.umd.js +14 -17
- package/dist/mobx-state-tree.umd.min.js +1 -1
- package/package.json +2 -3
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/js/mobx-state-tree)
|
|
6
6
|
[](https://circleci.com/gh/mobxjs/mobx-state-tree)
|
|
7
|
-
[](https://codecov.io/gh/mobxjs/mobx-state-tree)
|
|
8
8
|
[](https://github.com/mobxjs/mobx-state-tree/discussions)
|
|
9
9
|
|
|
10
10
|
## What is mobx-state-tree?
|
package/dist/mobx-state-tree.js
CHANGED
|
@@ -580,7 +580,7 @@ function resolveIdentifier(type, target, identifier) {
|
|
|
580
580
|
assertIsStateTreeNode(target, 2);
|
|
581
581
|
assertIsValidIdentifier(identifier, 3);
|
|
582
582
|
var node = getStateTreeNode(target).root.identifierCache.resolve(type, normalizeIdentifier(identifier));
|
|
583
|
-
return node ? node.value
|
|
583
|
+
return node === null || node === void 0 ? void 0 : node.value;
|
|
584
584
|
}
|
|
585
585
|
/**
|
|
586
586
|
* Returns the identifier of the target node.
|
|
@@ -3930,14 +3930,12 @@ function isMutable(value) {
|
|
|
3930
3930
|
*/
|
|
3931
3931
|
function isPrimitive(value, includeDate) {
|
|
3932
3932
|
if (includeDate === void 0) { includeDate = true; }
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3933
|
+
return (value === null ||
|
|
3934
|
+
value === undefined ||
|
|
3935
|
+
typeof value === "string" ||
|
|
3936
3936
|
typeof value === "number" ||
|
|
3937
3937
|
typeof value === "boolean" ||
|
|
3938
|
-
(includeDate && value instanceof Date))
|
|
3939
|
-
return true;
|
|
3940
|
-
return false;
|
|
3938
|
+
(includeDate && value instanceof Date));
|
|
3941
3939
|
}
|
|
3942
3940
|
/**
|
|
3943
3941
|
* @internal
|
|
@@ -5033,18 +5031,17 @@ var MapType = /** @class */ (function (_super) {
|
|
|
5033
5031
|
}
|
|
5034
5032
|
var modelTypes = [];
|
|
5035
5033
|
if (tryCollectModelTypes(this._subType, modelTypes)) {
|
|
5036
|
-
var
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
}
|
|
5042
|
-
identifierAttribute_1 = type.identifierAttribute;
|
|
5034
|
+
var identifierAttribute = modelTypes.reduce(function (current, type) {
|
|
5035
|
+
if (!type.identifierAttribute)
|
|
5036
|
+
return current;
|
|
5037
|
+
if (current && current !== type.identifierAttribute) {
|
|
5038
|
+
throw fail$1("The objects in a map should all have the same identifier attribute, expected '" + current + "', but child of type '" + type.name + "' declared attribute '" + type.identifierAttribute + "' as identifier");
|
|
5043
5039
|
}
|
|
5044
|
-
|
|
5045
|
-
|
|
5040
|
+
return type.identifierAttribute;
|
|
5041
|
+
}, undefined);
|
|
5042
|
+
if (identifierAttribute) {
|
|
5046
5043
|
this.identifierMode = MapIdentifierMode.YES;
|
|
5047
|
-
this.mapIdentifierAttribute =
|
|
5044
|
+
this.mapIdentifierAttribute = identifierAttribute;
|
|
5048
5045
|
}
|
|
5049
5046
|
else {
|
|
5050
5047
|
this.identifierMode = MapIdentifierMode.NO;
|