remove bare for .. of iterations - fixes #220

This commit is contained in:
Kevin Jahns
2020-07-12 20:04:56 +02:00
parent 5414ac7f6e
commit bb45816f05
10 changed files with 38 additions and 40 deletions

View File

@@ -74,9 +74,9 @@ export class YMap extends AbstractType {
*/
_integrate (y, item) {
super._integrate(y, item)
for (const [key, value] of /** @type {Map<string, any>} */ (this._prelimContent)) {
;/** @type {Map<string, any>} */ (this._prelimContent).forEach((value, key) => {
this.set(key, value)
}
})
this._prelimContent = null
}
@@ -104,12 +104,12 @@ export class YMap extends AbstractType {
* @type {Object<string,T>}
*/
const map = {}
for (const [key, item] of this._map) {
this._map.forEach((item, key) => {
if (!item.deleted) {
const v = item.content.getContent()[item.length - 1]
map[key] = v instanceof AbstractType ? v.toJSON() : v
}
}
})
return map
}
@@ -159,11 +159,11 @@ export class YMap extends AbstractType {
* @type {Object<string,T>}
*/
const map = {}
for (const [key, item] of this._map) {
this._map.forEach((item, key) => {
if (!item.deleted) {
f(item.content.getContent()[item.length - 1], key, this)
}
}
})
return map
}