SofaBuffers TypeScript - v0.11.0
    Preparing search index...

    Function elementsEqual

    • Element-wise equality for two array-likes: same length, and === at every index. Covers what a leaf array field can hold — Uint8Array (blob), and number[] / bigint[] / boolean[] / string[] — including a mixed pair such as a Uint8Array value against a plain-array default from the schema.

      Deliberately not deep: a nested (wrapper) array of messages is compared by the generated isDefault() of its element type, which is the only code that knows what a default element is. Equally deliberately ===, which makes NaN unequal to itself — matching the scalar !== test, the IEEE-754 rule the rest of the encoder follows, and the only reading under which an fp32/fp64 NaN element survives the round trip rather than being omitted as "default". There is no identity short-circuit for the same reason: elementsEqual(x, x) has to give the same answer as elementsEqual(x, x.slice()).

      Parameters

      • a: ArrayLike<unknown>
      • b: ArrayLike<unknown>

      Returns boolean