Remove unused return in forEach of YMap

If the idea is to keep the API as close to the JS Map as possible, maybe we should consider not returning here.

Ref: https://github.com/microsoft/TypeScript/blob/v4.8.3/lib/lib.es2015.collection.d.ts#L28-L31
This commit is contained in:
Wenchen Li 2022-09-19 18:19:41 -04:00 committed by GitHub
parent 56267e0a7d
commit 12667f6b66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,16 +167,11 @@ export class YMap extends AbstractType {
* @param {function(MapType,string,YMap<MapType>):void} f A function to execute on every element of this YArray.
*/
forEach (f) {
/**
* @type {Object<string,MapType>}
*/
const map = {}
this._map.forEach((item, key) => {
if (!item.deleted) {
f(item.content.getContent()[item.length - 1], key, this)
}
})
return map
}
/**