mobx 6.13.1 → 6.13.2
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/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/dist/mobx.cjs.development.js +13 -4
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +13 -4
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +13 -4
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +13 -4
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/dist/utils/utils.d.ts +12 -3
- package/package.json +1 -1
- package/src/types/observableset.ts +4 -4
- package/src/utils/utils.ts +12 -3
package/dist/utils/utils.d.ts
CHANGED
|
@@ -30,9 +30,18 @@ export declare function isGenerator(obj: any): boolean;
|
|
|
30
30
|
export declare function addHiddenProp(object: any, propName: PropertyKey, value: any): void;
|
|
31
31
|
export declare function addHiddenFinalProp(object: any, propName: PropertyKey, value: any): void;
|
|
32
32
|
export declare function createInstanceofPredicate<T>(name: string, theClass: new (...args: any[]) => T): (x: any) => x is T;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Yields true for both native and observable Map, even across different windows.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isES6Map(thing: unknown): thing is Map<any, any>;
|
|
37
|
+
/**
|
|
38
|
+
* Makes sure a Map is an instance of non-inherited native or observable Map.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isPlainES6Map(thing: Map<unknown, unknown>): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Yields true for both native and observable Set, even across different windows.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isES6Set(thing: unknown): thing is Set<any>;
|
|
36
45
|
/**
|
|
37
46
|
* Returns the following: own enumerable keys and symbols.
|
|
38
47
|
*/
|
package/package.json
CHANGED
|
@@ -244,7 +244,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
intersection<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T & U> {
|
|
247
|
-
if (isES6Set(otherSet)) {
|
|
247
|
+
if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
|
|
248
248
|
return otherSet.intersection(this)
|
|
249
249
|
} else {
|
|
250
250
|
const dehancedSet = new Set(this)
|
|
@@ -253,7 +253,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
union<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {
|
|
256
|
-
if (isES6Set(otherSet)) {
|
|
256
|
+
if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
|
|
257
257
|
return otherSet.union(this)
|
|
258
258
|
} else {
|
|
259
259
|
const dehancedSet = new Set(this)
|
|
@@ -266,7 +266,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
symmetricDifference<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {
|
|
269
|
-
if (isES6Set(otherSet)) {
|
|
269
|
+
if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
|
|
270
270
|
return otherSet.symmetricDifference(this)
|
|
271
271
|
} else {
|
|
272
272
|
const dehancedSet = new Set(this)
|
|
@@ -283,7 +283,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
isDisjointFrom(otherSet: ReadonlySetLike<unknown> | Set<unknown>): boolean {
|
|
286
|
-
if (isES6Set(otherSet)) {
|
|
286
|
+
if (isES6Set(otherSet) && !isObservableSet(otherSet)) {
|
|
287
287
|
return otherSet.isDisjointFrom(this)
|
|
288
288
|
} else {
|
|
289
289
|
const dehancedSet = new Set(this)
|
package/src/utils/utils.ts
CHANGED
|
@@ -140,18 +140,27 @@ export function createInstanceofPredicate<T>(
|
|
|
140
140
|
} as any
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Yields true for both native and observable Map, even across different windows.
|
|
145
|
+
*/
|
|
146
|
+
export function isES6Map(thing: unknown): thing is Map<any, any> {
|
|
144
147
|
return thing != null && Object.prototype.toString.call(thing) === "[object Map]"
|
|
145
148
|
}
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Makes sure a Map is an instance of non-inherited native or observable Map.
|
|
152
|
+
*/
|
|
153
|
+
export function isPlainES6Map(thing: Map<unknown, unknown>): boolean {
|
|
148
154
|
const mapProto = Object.getPrototypeOf(thing)
|
|
149
155
|
const objectProto = Object.getPrototypeOf(mapProto)
|
|
150
156
|
const nullProto = Object.getPrototypeOf(objectProto)
|
|
151
157
|
return nullProto === null
|
|
152
158
|
}
|
|
153
159
|
|
|
154
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Yields true for both native and observable Set, even across different windows.
|
|
162
|
+
*/
|
|
163
|
+
export function isES6Set(thing: unknown): thing is Set<any> {
|
|
155
164
|
return thing != null && Object.prototype.toString.call(thing) === "[object Set]"
|
|
156
165
|
}
|
|
157
166
|
|