@adobe/ecs - v0.2.1
    Preparing search index...

    Function create

    • Declares an index over components' values and returns it; nothing is built until a world's system or finalizer uses it. It holds the entities with every key part and every component in with, and none in not, keyed by the values of key, compared part by part: numbers and tuples by value, an entity with its generation, so a stale one finds nothing. With an empty key it holds those entities, every entity but the resource entity when with and not are empty too, and its lookup takes no key and gives them all, in entity order.

      • sorted: keeps key order, numbers numerically, NaN last, booleans false first, strings by code point, tuples element by element, then entity order, so a lookup takes a prefix of the key whose last part may be a comparison.
      • unique: at most one entity per key: a lookup by a whole key returns its row or null. When two entities share a key, the one with the lower entity index is kept, and the index fails the run or tick that found them.

      Throws if a key part isn't a registered component of data, is listed twice, is a set or map or shared, a sorted part has no order, its object parts live on different threads, or on another than the world's beside a string, which the world keeps its keys of, it's unique without a key, or with or not names a key that isn't a registered component or not names a key part or a with component.

      Type Parameters

      • const D extends Declaration

      Parameters

      • declaration: D & { components?: { has?: undefined; not?: readonly never[] } } & (
            D["key"] extends readonly [] ? { unique?: false } : unknown
        )

      Returns Index<D>