MCPcopy Create free account
hub / github.com/arktypeio/arktype / normalizeOrder

Function normalizeOrder

ark/schema/structure/structure.ts:1862–1874  ·  view source on GitHub ↗
(inner: mutable<Structure.Inner>)

Source from the content-addressed store, hash-verified

1860
1861// an order listing the props as they're sorted is dropped
1862export const normalizeOrder = (inner: mutable<Structure.Inner>): void => {
1863 const required = inner.required ?? []
1864 const optional = inner.optional ?? []
1865 if (
1866 inner.order?.length === required.length + optional.length &&
1867 inner.order.every(
1868 (k, i) =>
1869 k ===
1870 (i < required.length ? required[i] : optional[i - required.length]).key
1871 )
1872 )
1873 delete inner.order
1874}
1875
1876export const ownKeysOf = (data: object): Key[] => {
1877 const keys: Key[] = Object.keys(data)

Callers 1

structure.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected