[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Lookup](https://evolu.dev/docs/api-reference/common/Lookup) › structuralLookup

```ts
function structuralLookup<K>(key: Structural<K>): StructuralLookupKey;
```

Defined in: [packages/common/src/Lookup.ts:380](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Lookup.ts#L380)

Returns the structural lookup key for `key`.

Structural lookup keys are derived from JSON-like values plus `Uint8Array`.
Equal structures produce the same lookup key even when they are different
JavaScript instances. `undefined` values and sparse array holes are rejected
rather than skipped.

The derived key is memoized by non-null object identity in a module-scoped
`WeakMap` shared by all callers, so keys must be immutable.

Use this as a [Lookup](https://evolu.dev/docs/api-reference/common/Lookup/type-aliases/Lookup) when logical equality should be based on
structural value instead of reference identity.

### Example

```ts
import {
  assertEqual,
  assertSame,
  createLookupMap,
  structuralLookup,
  type StructuralLookupKey,
} from "@evolu/common";

interface Filter {
  readonly table: string;
  readonly where: readonly [string, string];
}

const byFilter = createLookupMap<Filter, string, StructuralLookupKey>({
  lookup: structuralLookup,
});

const cachedFilter: Filter = {
  table: "todo",
  where: ["owner", "ada"],
};
const equivalentFilter: Filter = {
  where: ["owner", "ada"],
  table: "todo",
};
byFilter.set(cachedFilter, "cached");

assertEqual(byFilter.get(equivalentFilter), "cached");
assertSame(byFilter.getKey(equivalentFilter), cachedFilter);
```

## See

- [StructuralKey](https://evolu.dev/docs/api-reference/common/Lookup/type-aliases/StructuralKey)
- [Structural](https://evolu.dev/docs/api-reference/common/Lookup/type-aliases/Structural)