MCPcopy Create free account
hub / github.com/esengine/esengine / find

Method find

packages/core/src/ECS/Utils/SparseSet.ts:183–190  ·  view source on GitHub ↗

* 查找第一个满足条件的元素 * * @param predicate 查找条件 * @returns 找到的元素,如果没有则返回undefined

(predicate: (item: T, index: number) => boolean)

Source from the content-addressed store, hash-verified

181 * @returns 找到的元素,如果没有则返回undefined
182 */
183 public find(predicate: (item: T, index: number) => boolean): T | undefined {
184 for (let i = 0; i < this._dense.length; i++) {
185 if (predicate(this._dense[i]!, i)) {
186 return this._dense[i];
187 }
188 }
189 return undefined;
190 }
191
192 /**
193 * 检查是否存在满足条件的元素

Callers 15

getLayerByIdMethod · 0.45
convertMethod · 0.45
useParticlePreviewFunction · 0.45
getModuleFunction · 0.45
addMethod · 0.45
internalAddMethod · 0.45
TileSetSelectorPanelFunction · 0.45
TilemapEditorPanelFunction · 0.45
getTemplateMethod · 0.45
findRootNodeMethod · 0.45
validateMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected