@traversable/schema
    Preparing search index...
    • Derive an "deep equal" function from an ArkType schema.

      A "deep equal" function" (see also, Equal) is similar to lodash's isEqual function, except more performant, because when the shape of the values being compared is known ahead of time, we can optimize ahead of time, and only check what's necessary.

      Note that the deep equal function generated by ark.deepEqual assumes that both values have already been validated. Passing unvalidated values to the function might result in undefined behavior.

      See also:

      Type Parameters

      • const S extends Any<any, any>
      • T = S["t"]

      Parameters

      • type: S

      Returns Type.Equal<T>

      import { ark } from '@traversable/arktype'

      const deepEqual = ark.deepEqual(
      type({
      street1: 'string',
      "street2?": 'string',
      city: 'string',
      })
      )

      deepEqual(
      { street1: '221 Baker St', street2: '#B', city: 'London' },
      { street1: '221 Baker St', street2: '#B', city: 'London' }
      ) // => true

      deepEqual(
      { street1: '221 Baker St', street2: '#B', city: 'London' },
      { street1: '4 Privet Dr', city: 'Little Whinging' }
      ) // => false