mobx 6.13.4 → 6.13.5
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/dist/mobx.cjs.development.js +8 -1
- 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 +8 -1
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +8 -1
- 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 +8 -1
- 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/package.json +1 -1
- package/src/utils/iterable.ts +11 -1
package/package.json
CHANGED
package/src/utils/iterable.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { getGlobal } from "../internal"
|
|
2
|
+
|
|
3
|
+
// safely get iterator prototype if available
|
|
4
|
+
const maybeIteratorPrototype = getGlobal().Iterator?.prototype || {}
|
|
5
|
+
|
|
1
6
|
export function makeIterable<T, TReturn = unknown>(
|
|
2
7
|
iterator: Iterator<T>
|
|
3
8
|
): IteratorObject<T, TReturn> {
|
|
4
|
-
|
|
9
|
+
iterator[Symbol.iterator] = getSelf
|
|
10
|
+
return Object.assign(Object.create(maybeIteratorPrototype), iterator)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getSelf() {
|
|
14
|
+
return this
|
|
5
15
|
}
|