mirror of https://github.com/vuejs/core.git
feat(reactivity): collection iteration should inherit iterator instance methods
This commit is contained in:
parent
e8e842241a
commit
9f08043780
|
@ -55,7 +55,10 @@ function createIterableMethod(
|
|||
)
|
||||
// return a wrapped iterator which returns observed versions of the
|
||||
// values emitted from the real iterator
|
||||
return {
|
||||
return extend(
|
||||
// inheriting all iterator properties
|
||||
Object.create(innerIterator),
|
||||
{
|
||||
// iterator protocol
|
||||
next() {
|
||||
const { value, done } = innerIterator.next()
|
||||
|
@ -70,7 +73,8 @@ function createIterableMethod(
|
|||
[Symbol.iterator]() {
|
||||
return this
|
||||
},
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue