Skip to content

Commit

Permalink
Replace fast-deep-equal to fast-equals
Browse files Browse the repository at this point in the history
  • Loading branch information
Semigradsky committed Mar 5, 2023
1 parent 45583fd commit d7b22b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/compile/resolve.ts
Expand Up @@ -2,7 +2,7 @@ import type {AnySchema, AnySchemaObject, UriResolver} from "../types"
import type Ajv from "../ajv"
import type {URIComponents} from "uri-js"
import {eachItem} from "./util"
import * as equal from "fast-deep-equal"
import {deepEqual} from "fast-equals"
import * as traverse from "json-schema-traverse"

// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution
Expand Down Expand Up @@ -140,7 +140,7 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc
return localRefs

function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void {
if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref)
if (sch2 !== undefined && !deepEqual(sch1, sch2)) throw ambiguos(ref)
}

function ambiguos(ref: string): Error {
Expand Down
8 changes: 4 additions & 4 deletions lib/runtime/equal.ts
@@ -1,7 +1,7 @@
// https://github.com/ajv-validator/ajv/issues/889
import * as equal from "fast-deep-equal"
import {deepEqual} from "fast-equals"

type Equal = typeof equal & {code: string}
;(equal as Equal).code = 'require("ajv/dist/runtime/equal").default'
type Equal = typeof deepEqual & {code: string}
;(deepEqual as Equal).code = 'require("ajv/dist/runtime/equal").default'

export default equal as Equal
export default deepEqual as Equal
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -58,7 +58,7 @@
"homepage": "https://ajv.js.org",
"runkitExampleFilename": ".runkit_example.js",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-equals": "^5.0.0",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
Expand Down

0 comments on commit d7b22b3

Please sign in to comment.