From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送

---
 node_modules/ajv/lib/compile/jtd/serialize.ts |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/node_modules/ajv/lib/compile/jtd/serialize.ts b/node_modules/ajv/lib/compile/jtd/serialize.ts
index 1d22882..42a47cf 100644
--- a/node_modules/ajv/lib/compile/jtd/serialize.ts
+++ b/node_modules/ajv/lib/compile/jtd/serialize.ts
@@ -228,8 +228,19 @@
   gen.add(N.json, _`${useFunc(gen, quote)}(${data})`)
 }
 
-function serializeNumber({gen, data}: SerializeCxt): void {
-  gen.add(N.json, _`"" + ${data}`)
+function serializeNumber({gen, data, self}: SerializeCxt): void {
+  const condition = _`${data} === Infinity || ${data} === -Infinity || ${data} !== ${data}`
+
+  if (self.opts.specialNumbers === undefined || self.opts.specialNumbers === "fast") {
+    gen.add(N.json, _`"" + ${data}`)
+  } else {
+    // specialNumbers === "null"
+    gen.if(
+      condition,
+      () => gen.add(N.json, _`null`),
+      () => gen.add(N.json, _`"" + ${data}`)
+    )
+  }
 }
 
 function serializeRef(cxt: SerializeCxt): void {

--
Gitblit v1.9.3