mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-19 05:31:56 +02:00
refactor: remove useless .indexOf to improve perf (#1783)
This commit is contained in:
committed by
Ian Storm Taylor
parent
d6245fbadf
commit
404862c579
@@ -1854,13 +1854,12 @@ class Node {
|
||||
mapDescendants(iterator) {
|
||||
let { nodes } = this
|
||||
|
||||
nodes.forEach((node, i) => {
|
||||
nodes.forEach((node, index) => {
|
||||
let ret = node
|
||||
if (ret.object != 'text') ret = ret.mapDescendants(iterator)
|
||||
ret = iterator(ret, i, this.nodes)
|
||||
ret = iterator(ret, index, this.nodes)
|
||||
if (ret == node) return
|
||||
|
||||
const index = nodes.indexOf(node)
|
||||
nodes = nodes.set(index, ret)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user