@fangzhongya/utils 0.0.63 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-LHJNQXEL.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-TV763MO4.cjs');
2
2
 
3
3
 
4
- var _chunkL4JXPCBWcjs = require('../chunk-L4JXPCBW.cjs');
4
+ var _chunkXLYPGPDBcjs = require('../chunk-XLYPGPDB.cjs');
5
5
  require('../chunk-ZZKR5C3Y.cjs');
6
6
  require('../chunk-K2XKKEE7.cjs');
7
- require('../chunk-SHT5THEZ.cjs');
7
+ require('../chunk-TKE7IK2M.cjs');
8
8
  require('../chunk-HLKHFBMF.cjs');
9
9
  require('../chunk-HWHYHL6J.cjs');
10
10
  require('../chunk-J7S3KBHL.cjs');
@@ -52,4 +52,4 @@ require('../chunk-75ZPJI57.cjs');
52
52
 
53
53
 
54
54
 
55
- exports.array = _chunk65O7KWP4cjs.array_exports; exports.object = _chunkKZCLX66Dcjs.object_exports; exports.string = _chunkL4JXPCBWcjs.string_exports;
55
+ exports.array = _chunk65O7KWP4cjs.array_exports; exports.object = _chunkKZCLX66Dcjs.object_exports; exports.string = _chunkXLYPGPDBcjs.string_exports;
@@ -1,10 +1,10 @@
1
- import "../chunk-JLO73Y7O.js";
1
+ import "../chunk-F4E66MPZ.js";
2
2
  import {
3
3
  string_exports
4
- } from "../chunk-NL6Q47ZV.js";
4
+ } from "../chunk-CGDNKEYI.js";
5
5
  import "../chunk-SE2X5XKO.js";
6
6
  import "../chunk-TIZFQBWC.js";
7
- import "../chunk-FIODV4DZ.js";
7
+ import "../chunk-ZADO6V3Z.js";
8
8
  import "../chunk-ADPTUJSF.js";
9
9
  import "../chunk-N5Y3XGHX.js";
10
10
  import "../chunk-7DTHADVK.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-L4JXPCBW.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-XLYPGPDB.cjs');
2
2
 
3
3
 
4
4
 
@@ -12,7 +12,7 @@ var _chunkK2XKKEE7cjs = require('../../chunk-K2XKKEE7.cjs');
12
12
 
13
13
 
14
14
 
15
- var _chunkSHT5THEZcjs = require('../../chunk-SHT5THEZ.cjs');
15
+ var _chunkTKE7IK2Mcjs = require('../../chunk-TKE7IK2M.cjs');
16
16
 
17
17
 
18
18
  var _chunkHLKHFBMFcjs = require('../../chunk-HLKHFBMF.cjs');
@@ -88,4 +88,4 @@ require('../../chunk-75ZPJI57.cjs');
88
88
 
89
89
 
90
90
 
91
- exports.appearNum = _chunkOJBZ7UUCcjs.appearNum; exports.appearNumSeat = _chunkJR6ZN6QDcjs.appearNumSeat; exports.deComment = _chunkXWCRGY54cjs.deComment; exports.extractParams = _chunkJJ37YIPJcjs.extractParams; exports.firstLower = _chunkUEVMS6QDcjs.firstLower; exports.firstUpper = _chunkOQL4GIEJcjs.firstUpper; exports.getContent = _chunk4PUYFFPOcjs.getContent; exports.getContents = _chunk4PUYFFPOcjs.getContents; exports.getFunctionFormat = _chunkJJ37YIPJcjs.getFunctionFormat; exports.getImports = _chunkHWHYHL6Jcjs.getImports; exports.getImportss = _chunkHWHYHL6Jcjs.getImportss; exports.getStartSame = _chunkJ7S3KBHLcjs.getStartSame; exports.getStartSames = _chunkPW7RP73Jcjs.getStartSames; exports.getStrNunPosit = _chunk2H3KVSFAcjs.getStrNunPosit; exports.serializeCodeBlock = _chunkSHT5THEZcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkSHT5THEZcjs.serializeFunctionRef; exports.splitUpper = _chunkL7FSHU27cjs.splitUpper; exports.startsNum = _chunkILJLXJ5Ocjs.startsNum; exports.toFunction = _chunkJJ37YIPJcjs.toFunction; exports.toFunctionParam = _chunkZZKR5C3Ycjs.toFunctionParam; exports.toFunctionParamOptions = _chunkZZKR5C3Ycjs.toFunctionParamOptions; exports.toJSONParse = _chunkK2XKKEE7cjs.toJSONParse; exports.toJSONSParse = _chunkSHT5THEZcjs.toJSONSParse; exports.toJSONSStringify = _chunkSHT5THEZcjs.toJSONSStringify; exports.toJSONStringify = _chunkK2XKKEE7cjs.toJSONStringify; exports.toStringParse = _chunkHLKHFBMFcjs.toStringParse;
91
+ exports.appearNum = _chunkOJBZ7UUCcjs.appearNum; exports.appearNumSeat = _chunkJR6ZN6QDcjs.appearNumSeat; exports.deComment = _chunkXWCRGY54cjs.deComment; exports.extractParams = _chunkJJ37YIPJcjs.extractParams; exports.firstLower = _chunkUEVMS6QDcjs.firstLower; exports.firstUpper = _chunkOQL4GIEJcjs.firstUpper; exports.getContent = _chunk4PUYFFPOcjs.getContent; exports.getContents = _chunk4PUYFFPOcjs.getContents; exports.getFunctionFormat = _chunkJJ37YIPJcjs.getFunctionFormat; exports.getImports = _chunkHWHYHL6Jcjs.getImports; exports.getImportss = _chunkHWHYHL6Jcjs.getImportss; exports.getStartSame = _chunkJ7S3KBHLcjs.getStartSame; exports.getStartSames = _chunkPW7RP73Jcjs.getStartSames; exports.getStrNunPosit = _chunk2H3KVSFAcjs.getStrNunPosit; exports.serializeCodeBlock = _chunkTKE7IK2Mcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkTKE7IK2Mcjs.serializeFunctionRef; exports.splitUpper = _chunkL7FSHU27cjs.splitUpper; exports.startsNum = _chunkILJLXJ5Ocjs.startsNum; exports.toFunction = _chunkJJ37YIPJcjs.toFunction; exports.toFunctionParam = _chunkZZKR5C3Ycjs.toFunctionParam; exports.toFunctionParamOptions = _chunkZZKR5C3Ycjs.toFunctionParamOptions; exports.toJSONParse = _chunkK2XKKEE7cjs.toJSONParse; exports.toJSONSParse = _chunkTKE7IK2Mcjs.toJSONSParse; exports.toJSONSStringify = _chunkTKE7IK2Mcjs.toJSONSStringify; exports.toJSONStringify = _chunkK2XKKEE7cjs.toJSONStringify; exports.toStringParse = _chunkHLKHFBMFcjs.toStringParse;
@@ -1,4 +1,4 @@
1
- import "../../chunk-NL6Q47ZV.js";
1
+ import "../../chunk-CGDNKEYI.js";
2
2
  import {
3
3
  toFunctionParam,
4
4
  toFunctionParamOptions
@@ -12,7 +12,7 @@ import {
12
12
  serializeFunctionRef,
13
13
  toJSONSParse,
14
14
  toJSONSStringify
15
- } from "../../chunk-FIODV4DZ.js";
15
+ } from "../../chunk-ZADO6V3Z.js";
16
16
  import {
17
17
  toStringParse
18
18
  } from "../../chunk-ADPTUJSF.js";
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkSHT5THEZcjs = require('../../chunk-SHT5THEZ.cjs');
6
+ var _chunkTKE7IK2Mcjs = require('../../chunk-TKE7IK2M.cjs');
7
7
  require('../../chunk-JJ37YIPJ.cjs');
8
8
  require('../../chunk-A5UJF6LP.cjs');
9
9
  require('../../chunk-75ZPJI57.cjs');
@@ -12,4 +12,4 @@ require('../../chunk-75ZPJI57.cjs');
12
12
 
13
13
 
14
14
 
15
- exports.serializeCodeBlock = _chunkSHT5THEZcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkSHT5THEZcjs.serializeFunctionRef; exports.toJSONSParse = _chunkSHT5THEZcjs.toJSONSParse; exports.toJSONSStringify = _chunkSHT5THEZcjs.toJSONSStringify;
15
+ exports.serializeCodeBlock = _chunkTKE7IK2Mcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkTKE7IK2Mcjs.serializeFunctionRef; exports.toJSONSParse = _chunkTKE7IK2Mcjs.toJSONSParse; exports.toJSONSStringify = _chunkTKE7IK2Mcjs.toJSONSStringify;
@@ -1,5 +1,6 @@
1
1
  type ObjAny<T = any> = Record<string | number | symbol, T>;
2
2
  declare const TYPE_MARKERS: {
3
+ CIRCULAR_REF: string;
3
4
  FUNCTION_REF: string;
4
5
  CODE_BLOCK: string;
5
6
  /**内置对象*/
@@ -1,5 +1,6 @@
1
1
  type ObjAny<T = any> = Record<string | number | symbol, T>;
2
2
  declare const TYPE_MARKERS: {
3
+ CIRCULAR_REF: string;
3
4
  FUNCTION_REF: string;
4
5
  CODE_BLOCK: string;
5
6
  /**内置对象*/
@@ -3,7 +3,7 @@ import {
3
3
  serializeFunctionRef,
4
4
  toJSONSParse,
5
5
  toJSONSStringify
6
- } from "../../chunk-FIODV4DZ.js";
6
+ } from "../../chunk-ZADO6V3Z.js";
7
7
  import "../../chunk-Q6BNW3MO.js";
8
8
  import "../../chunk-SHNH5OEU.js";
9
9
  import "../../chunk-MLKGABMK.js";
@@ -11,7 +11,7 @@ import {
11
11
  serializeFunctionRef,
12
12
  toJSONSParse,
13
13
  toJSONSStringify
14
- } from "./chunk-FIODV4DZ.js";
14
+ } from "./chunk-ZADO6V3Z.js";
15
15
  import {
16
16
  toStringParse
17
17
  } from "./chunk-ADPTUJSF.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  string_exports
3
- } from "./chunk-NL6Q47ZV.js";
3
+ } from "./chunk-CGDNKEYI.js";
4
4
  import {
5
5
  object_exports
6
6
  } from "./chunk-7M7ORCKS.js";
@@ -7,6 +7,9 @@ var _chunkA5UJF6LPcjs = require('./chunk-A5UJF6LP.cjs');
7
7
 
8
8
  // packages/basic/string/toJsons.ts
9
9
  var TYPE_MARKERS = {
10
+ // 对象引用
11
+ CIRCULAR_REF: "_CR_",
12
+ // 新增:循环引用标记
10
13
  FUNCTION_REF: "_FR_",
11
14
  CODE_BLOCK: "_CB_",
12
15
  /**内置对象*/
@@ -93,20 +96,102 @@ var arrayBufferUtils = {
93
96
  return buffer;
94
97
  }
95
98
  };
99
+ function getObjectPath(obj, key, seen) {
100
+ if (obj === null || obj === void 0) {
101
+ return String(key);
102
+ }
103
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
104
+ return String(key);
105
+ }
106
+ const objPath = seen.get(obj);
107
+ if (objPath) {
108
+ return Array.isArray(obj) ? `${objPath}[${key}]` : `${objPath}.${key}`;
109
+ }
110
+ const path = `root${key}`;
111
+ if (typeof obj === "object" && obj !== null && !seen.has(obj)) {
112
+ seen.set(obj, path);
113
+ }
114
+ return path;
115
+ }
116
+ function getObjectPathValue(obj, key) {
117
+ if (key === "root") {
118
+ return obj;
119
+ }
120
+ let path = key;
121
+ if (path.startsWith("root")) {
122
+ path = path.slice(4);
123
+ }
124
+ if (!path) {
125
+ return obj;
126
+ }
127
+ const parts = [];
128
+ let current = "";
129
+ let inArray = false;
130
+ let bracketDepth = 0;
131
+ for (let i = 0; i < path.length; i++) {
132
+ const char = path[i];
133
+ if (char === "[") {
134
+ if (current) {
135
+ parts.push(current);
136
+ current = "";
137
+ }
138
+ inArray = true;
139
+ current += char;
140
+ bracketDepth++;
141
+ } else if (char === "]") {
142
+ current += char;
143
+ bracketDepth--;
144
+ if (bracketDepth === 0) {
145
+ const arrayIndex = current.slice(1, -1);
146
+ parts.push(arrayIndex);
147
+ current = "";
148
+ inArray = false;
149
+ }
150
+ } else if (char === "." && !inArray) {
151
+ if (current) {
152
+ parts.push(current);
153
+ current = "";
154
+ }
155
+ } else {
156
+ current += char;
157
+ }
158
+ }
159
+ if (current) {
160
+ parts.push(current);
161
+ }
162
+ let result = obj;
163
+ for (const part of parts) {
164
+ if (result === null || result === void 0) {
165
+ return void 0;
166
+ }
167
+ const num = Number(part);
168
+ const index = !isNaN(num) && part.trim() !== "" ? num : part;
169
+ result = result[index];
170
+ }
171
+ return result;
172
+ }
96
173
  function toJSONSStringify(obj, space, filtrat = "__") {
97
- const seen = /* @__PURE__ */ new WeakSet();
174
+ const seen = /* @__PURE__ */ new WeakMap();
98
175
  return JSON.stringify(
99
176
  obj,
100
177
  function(key, value) {
178
+ const fullPath = this === null || this === void 0 ? key : getObjectPath(this, key, seen);
101
179
  if (filtrat && key.startsWith(filtrat)) {
102
180
  return void 0;
103
181
  }
104
182
  if (value === null) {
105
183
  return null;
106
184
  }
107
- if (typeof value === "object") {
108
- if (seen.has(value)) return "[Circular]";
109
- seen.add(value);
185
+ if (typeof value === "object" && value !== null) {
186
+ const existingPath = seen.get(value);
187
+ if (existingPath && existingPath !== fullPath) {
188
+ return {
189
+ [TYPE_MARKERS.CIRCULAR_REF]: existingPath
190
+ };
191
+ }
192
+ if (!seen.has(value)) {
193
+ seen.set(value, fullPath);
194
+ }
110
195
  }
111
196
  if (this[key] instanceof Date) {
112
197
  return {
@@ -280,7 +365,7 @@ function toJSONSParse(str, context) {
280
365
  }
281
366
  return value;
282
367
  });
283
- return restoreSpecialValues(parsed);
368
+ return restoreSpecialValues(parsed, parsed);
284
369
  } catch (error) {
285
370
  console.error("JSON parse error:", {
286
371
  str: str.slice(0, 200) + "...",
@@ -289,36 +374,36 @@ function toJSONSParse(str, context) {
289
374
  return {};
290
375
  }
291
376
  }
292
- function restoreSpecialValues(obj, depth = 0) {
377
+ function restoreSpecialValues(original, obj, depth = 0) {
293
378
  if (depth > 100) throw new Error("Recursion limit exceeded");
294
379
  if (obj === null || typeof obj !== "object") {
295
380
  return obj;
296
381
  }
297
382
  if (Array.isArray(obj)) {
298
383
  return obj.map((item) => {
299
- const converted = convertSpecialValue(item);
384
+ const converted = convertSpecialValue(original, item);
300
385
  if (converted !== item) {
301
386
  return converted;
302
387
  }
303
- return restoreSpecialValues(item, depth + 1);
388
+ return restoreSpecialValues(original, item, depth + 1);
304
389
  });
305
390
  }
306
391
  const result = {};
307
392
  for (const key in obj) {
308
393
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
309
394
  let value = obj[key];
310
- const converted = convertSpecialValue(value);
395
+ const converted = convertSpecialValue(original, value);
311
396
  if (converted !== value) {
312
397
  value = converted;
313
398
  } else {
314
- value = restoreSpecialValues(value, depth + 1);
399
+ value = restoreSpecialValues(original, value, depth + 1);
315
400
  }
316
401
  result[key] = value;
317
402
  }
318
403
  }
319
404
  return result;
320
405
  }
321
- function convertSpecialValue(value) {
406
+ function convertSpecialValue(original, value) {
322
407
  if (value && typeof value === "object") {
323
408
  const keys = Object.keys(value);
324
409
  if (keys.length === 1) {
@@ -397,6 +482,9 @@ function convertSpecialValue(value) {
397
482
  const buffer = arrayBufferUtils.decode(markerValue.b);
398
483
  return new DataView(buffer, markerValue.o, markerValue.l);
399
484
  }
485
+ case TYPE_MARKERS.CIRCULAR_REF: {
486
+ return getObjectPathValue(original, markerValue);
487
+ }
400
488
  }
401
489
  }
402
490
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkL4JXPCBWcjs = require('./chunk-L4JXPCBW.cjs');
3
+ var _chunkXLYPGPDBcjs = require('./chunk-XLYPGPDB.cjs');
4
4
 
5
5
 
6
6
  var _chunkKZCLX66Dcjs = require('./chunk-KZCLX66D.cjs');
@@ -16,7 +16,7 @@ var basic_exports = {};
16
16
  _chunk75ZPJI57cjs.__export.call(void 0, basic_exports, {
17
17
  array: () => _chunk65O7KWP4cjs.array_exports,
18
18
  object: () => _chunkKZCLX66Dcjs.object_exports,
19
- string: () => _chunkL4JXPCBWcjs.string_exports
19
+ string: () => _chunkXLYPGPDBcjs.string_exports
20
20
  });
21
21
 
22
22
 
@@ -11,7 +11,7 @@ var _chunkK2XKKEE7cjs = require('./chunk-K2XKKEE7.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkSHT5THEZcjs = require('./chunk-SHT5THEZ.cjs');
14
+ var _chunkTKE7IK2Mcjs = require('./chunk-TKE7IK2M.cjs');
15
15
 
16
16
 
17
17
  var _chunkHLKHFBMFcjs = require('./chunk-HLKHFBMF.cjs');
@@ -79,16 +79,16 @@ _chunk75ZPJI57cjs.__export.call(void 0, string_exports, {
79
79
  getStartSame: () => _chunkJ7S3KBHLcjs.getStartSame,
80
80
  getStartSames: () => _chunkPW7RP73Jcjs.getStartSames,
81
81
  getStrNunPosit: () => _chunk2H3KVSFAcjs.getStrNunPosit,
82
- serializeCodeBlock: () => _chunkSHT5THEZcjs.serializeCodeBlock,
83
- serializeFunctionRef: () => _chunkSHT5THEZcjs.serializeFunctionRef,
82
+ serializeCodeBlock: () => _chunkTKE7IK2Mcjs.serializeCodeBlock,
83
+ serializeFunctionRef: () => _chunkTKE7IK2Mcjs.serializeFunctionRef,
84
84
  splitUpper: () => _chunkL7FSHU27cjs.splitUpper,
85
85
  startsNum: () => _chunkILJLXJ5Ocjs.startsNum,
86
86
  toFunction: () => _chunkJJ37YIPJcjs.toFunction,
87
87
  toFunctionParam: () => _chunkZZKR5C3Ycjs.toFunctionParam,
88
88
  toFunctionParamOptions: () => _chunkZZKR5C3Ycjs.toFunctionParamOptions,
89
89
  toJSONParse: () => _chunkK2XKKEE7cjs.toJSONParse,
90
- toJSONSParse: () => _chunkSHT5THEZcjs.toJSONSParse,
91
- toJSONSStringify: () => _chunkSHT5THEZcjs.toJSONSStringify,
90
+ toJSONSParse: () => _chunkTKE7IK2Mcjs.toJSONSParse,
91
+ toJSONSStringify: () => _chunkTKE7IK2Mcjs.toJSONSStringify,
92
92
  toJSONStringify: () => _chunkK2XKKEE7cjs.toJSONStringify,
93
93
  toStringParse: () => _chunkHLKHFBMFcjs.toStringParse
94
94
  });
@@ -7,6 +7,9 @@ import {
7
7
 
8
8
  // packages/basic/string/toJsons.ts
9
9
  var TYPE_MARKERS = {
10
+ // 对象引用
11
+ CIRCULAR_REF: "_CR_",
12
+ // 新增:循环引用标记
10
13
  FUNCTION_REF: "_FR_",
11
14
  CODE_BLOCK: "_CB_",
12
15
  /**内置对象*/
@@ -93,20 +96,102 @@ var arrayBufferUtils = {
93
96
  return buffer;
94
97
  }
95
98
  };
99
+ function getObjectPath(obj, key, seen) {
100
+ if (obj === null || obj === void 0) {
101
+ return String(key);
102
+ }
103
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
104
+ return String(key);
105
+ }
106
+ const objPath = seen.get(obj);
107
+ if (objPath) {
108
+ return Array.isArray(obj) ? `${objPath}[${key}]` : `${objPath}.${key}`;
109
+ }
110
+ const path = `root${key}`;
111
+ if (typeof obj === "object" && obj !== null && !seen.has(obj)) {
112
+ seen.set(obj, path);
113
+ }
114
+ return path;
115
+ }
116
+ function getObjectPathValue(obj, key) {
117
+ if (key === "root") {
118
+ return obj;
119
+ }
120
+ let path = key;
121
+ if (path.startsWith("root")) {
122
+ path = path.slice(4);
123
+ }
124
+ if (!path) {
125
+ return obj;
126
+ }
127
+ const parts = [];
128
+ let current = "";
129
+ let inArray = false;
130
+ let bracketDepth = 0;
131
+ for (let i = 0; i < path.length; i++) {
132
+ const char = path[i];
133
+ if (char === "[") {
134
+ if (current) {
135
+ parts.push(current);
136
+ current = "";
137
+ }
138
+ inArray = true;
139
+ current += char;
140
+ bracketDepth++;
141
+ } else if (char === "]") {
142
+ current += char;
143
+ bracketDepth--;
144
+ if (bracketDepth === 0) {
145
+ const arrayIndex = current.slice(1, -1);
146
+ parts.push(arrayIndex);
147
+ current = "";
148
+ inArray = false;
149
+ }
150
+ } else if (char === "." && !inArray) {
151
+ if (current) {
152
+ parts.push(current);
153
+ current = "";
154
+ }
155
+ } else {
156
+ current += char;
157
+ }
158
+ }
159
+ if (current) {
160
+ parts.push(current);
161
+ }
162
+ let result = obj;
163
+ for (const part of parts) {
164
+ if (result === null || result === void 0) {
165
+ return void 0;
166
+ }
167
+ const num = Number(part);
168
+ const index = !isNaN(num) && part.trim() !== "" ? num : part;
169
+ result = result[index];
170
+ }
171
+ return result;
172
+ }
96
173
  function toJSONSStringify(obj, space, filtrat = "__") {
97
- const seen = /* @__PURE__ */ new WeakSet();
174
+ const seen = /* @__PURE__ */ new WeakMap();
98
175
  return JSON.stringify(
99
176
  obj,
100
177
  function(key, value) {
178
+ const fullPath = this === null || this === void 0 ? key : getObjectPath(this, key, seen);
101
179
  if (filtrat && key.startsWith(filtrat)) {
102
180
  return void 0;
103
181
  }
104
182
  if (value === null) {
105
183
  return null;
106
184
  }
107
- if (typeof value === "object") {
108
- if (seen.has(value)) return "[Circular]";
109
- seen.add(value);
185
+ if (typeof value === "object" && value !== null) {
186
+ const existingPath = seen.get(value);
187
+ if (existingPath && existingPath !== fullPath) {
188
+ return {
189
+ [TYPE_MARKERS.CIRCULAR_REF]: existingPath
190
+ };
191
+ }
192
+ if (!seen.has(value)) {
193
+ seen.set(value, fullPath);
194
+ }
110
195
  }
111
196
  if (this[key] instanceof Date) {
112
197
  return {
@@ -280,7 +365,7 @@ function toJSONSParse(str, context) {
280
365
  }
281
366
  return value;
282
367
  });
283
- return restoreSpecialValues(parsed);
368
+ return restoreSpecialValues(parsed, parsed);
284
369
  } catch (error) {
285
370
  console.error("JSON parse error:", {
286
371
  str: str.slice(0, 200) + "...",
@@ -289,36 +374,36 @@ function toJSONSParse(str, context) {
289
374
  return {};
290
375
  }
291
376
  }
292
- function restoreSpecialValues(obj, depth = 0) {
377
+ function restoreSpecialValues(original, obj, depth = 0) {
293
378
  if (depth > 100) throw new Error("Recursion limit exceeded");
294
379
  if (obj === null || typeof obj !== "object") {
295
380
  return obj;
296
381
  }
297
382
  if (Array.isArray(obj)) {
298
383
  return obj.map((item) => {
299
- const converted = convertSpecialValue(item);
384
+ const converted = convertSpecialValue(original, item);
300
385
  if (converted !== item) {
301
386
  return converted;
302
387
  }
303
- return restoreSpecialValues(item, depth + 1);
388
+ return restoreSpecialValues(original, item, depth + 1);
304
389
  });
305
390
  }
306
391
  const result = {};
307
392
  for (const key in obj) {
308
393
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
309
394
  let value = obj[key];
310
- const converted = convertSpecialValue(value);
395
+ const converted = convertSpecialValue(original, value);
311
396
  if (converted !== value) {
312
397
  value = converted;
313
398
  } else {
314
- value = restoreSpecialValues(value, depth + 1);
399
+ value = restoreSpecialValues(original, value, depth + 1);
315
400
  }
316
401
  result[key] = value;
317
402
  }
318
403
  }
319
404
  return result;
320
405
  }
321
- function convertSpecialValue(value) {
406
+ function convertSpecialValue(original, value) {
322
407
  if (value && typeof value === "object") {
323
408
  const keys = Object.keys(value);
324
409
  if (keys.length === 1) {
@@ -397,6 +482,9 @@ function convertSpecialValue(value) {
397
482
  const buffer = arrayBufferUtils.decode(markerValue.b);
398
483
  return new DataView(buffer, markerValue.o, markerValue.l);
399
484
  }
485
+ case TYPE_MARKERS.CIRCULAR_REF: {
486
+ return getObjectPathValue(original, markerValue);
487
+ }
400
488
  }
401
489
  }
402
490
  }
@@ -1,39 +1,39 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-4MF6LYYS.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-XDTLZL44.cjs');
2
2
 
3
3
 
4
- var _chunk4X7AFGTVcjs = require('../chunk-4X7AFGTV.cjs');
5
- require('../chunk-LTVXRDTD.cjs');
4
+ var _chunkSJPWB2OHcjs = require('../chunk-SJPWB2OH.cjs');
6
5
 
7
6
 
7
+ var _chunkGFAUQTB2cjs = require('../chunk-GFAUQTB2.cjs');
8
8
 
9
- var _chunkHJTIJGIFcjs = require('../chunk-HJTIJGIF.cjs');
10
9
 
10
+ var _chunkCTLBHJGFcjs = require('../chunk-CTLBHJGF.cjs');
11
11
 
12
- var _chunkVY5VQ7WEcjs = require('../chunk-VY5VQ7WE.cjs');
13
12
 
13
+ var _chunk4X7AFGTVcjs = require('../chunk-4X7AFGTV.cjs');
14
+ require('../chunk-LTVXRDTD.cjs');
14
15
 
15
- var _chunkUGS2F6DKcjs = require('../chunk-UGS2F6DK.cjs');
16
16
 
17
17
 
18
- var _chunkIFVVMDAWcjs = require('../chunk-IFVVMDAW.cjs');
18
+ var _chunkHJTIJGIFcjs = require('../chunk-HJTIJGIF.cjs');
19
19
 
20
20
 
21
- var _chunk6TH2K7LEcjs = require('../chunk-6TH2K7LE.cjs');
21
+ var _chunkUGFSIZ5Pcjs = require('../chunk-UGFSIZ5P.cjs');
22
22
 
23
23
 
24
- var _chunkSJPWB2OHcjs = require('../chunk-SJPWB2OH.cjs');
24
+ var _chunkTE3XNGF4cjs = require('../chunk-TE3XNGF4.cjs');
25
25
 
26
26
 
27
- var _chunkGFAUQTB2cjs = require('../chunk-GFAUQTB2.cjs');
27
+ var _chunkVY5VQ7WEcjs = require('../chunk-VY5VQ7WE.cjs');
28
28
 
29
29
 
30
- var _chunkCTLBHJGFcjs = require('../chunk-CTLBHJGF.cjs');
30
+ var _chunkUGS2F6DKcjs = require('../chunk-UGS2F6DK.cjs');
31
31
 
32
32
 
33
- var _chunkUGFSIZ5Pcjs = require('../chunk-UGFSIZ5P.cjs');
33
+ var _chunkIFVVMDAWcjs = require('../chunk-IFVVMDAW.cjs');
34
34
 
35
35
 
36
- var _chunkTE3XNGF4cjs = require('../chunk-TE3XNGF4.cjs');
36
+ var _chunk6TH2K7LEcjs = require('../chunk-6TH2K7LE.cjs');
37
37
  require('../chunk-75ZPJI57.cjs');
38
38
 
39
39
 
package/dist/css/index.js CHANGED
@@ -1,4 +1,13 @@
1
- import "../chunk-HWQYLP45.js";
1
+ import "../chunk-M7CA6X7T.js";
2
+ import {
3
+ getScssImports
4
+ } from "../chunk-NW2ZNMSV.js";
5
+ import {
6
+ getSVG
7
+ } from "../chunk-WIYZQNGO.js";
8
+ import {
9
+ setClassName
10
+ } from "../chunk-D3YMEKIF.js";
2
11
  import {
3
12
  setCss
4
13
  } from "../chunk-XUL6LPTN.js";
@@ -7,6 +16,12 @@ import {
7
16
  setObjStyle,
8
17
  toStyleString
9
18
  } from "../chunk-M323GS33.js";
19
+ import {
20
+ fetchUnitValue
21
+ } from "../chunk-WX3JYE47.js";
22
+ import {
23
+ getAttrObj
24
+ } from "../chunk-N3FZ4WUI.js";
10
25
  import {
11
26
  getPositionRelative
12
27
  } from "../chunk-MQHLAQQA.js";
@@ -19,21 +34,6 @@ import {
19
34
  import {
20
35
  getPrentCorres
21
36
  } from "../chunk-VNY5UA2Q.js";
22
- import {
23
- getScssImports
24
- } from "../chunk-NW2ZNMSV.js";
25
- import {
26
- getSVG
27
- } from "../chunk-WIYZQNGO.js";
28
- import {
29
- setClassName
30
- } from "../chunk-D3YMEKIF.js";
31
- import {
32
- fetchUnitValue
33
- } from "../chunk-WX3JYE47.js";
34
- import {
35
- getAttrObj
36
- } from "../chunk-N3FZ4WUI.js";
37
37
  import "../chunk-MLKGABMK.js";
38
38
  export {
39
39
  fetchUnitValue,
@@ -1,14 +1,14 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-7NEXCOZZ.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-5SOPYS7L.cjs');
2
2
 
3
3
 
4
+ var _chunkZ2EAQZ47cjs = require('../chunk-Z2EAQZ47.cjs');
4
5
 
5
- var _chunk7TGGIID4cjs = require('../chunk-7TGGIID4.cjs');
6
6
 
7
7
 
8
- var _chunk75UYCE4Xcjs = require('../chunk-75UYCE4X.cjs');
8
+ var _chunk7TGGIID4cjs = require('../chunk-7TGGIID4.cjs');
9
9
 
10
10
 
11
- var _chunkZ2EAQZ47cjs = require('../chunk-Z2EAQZ47.cjs');
11
+ var _chunk75UYCE4Xcjs = require('../chunk-75UYCE4X.cjs');
12
12
  require('../chunk-75ZPJI57.cjs');
13
13
 
14
14
 
@@ -1,4 +1,7 @@
1
- import "../chunk-JPQN3LUH.js";
1
+ import "../chunk-H22VVRP6.js";
2
+ import {
3
+ hourFormat
4
+ } from "../chunk-UCF3YRN2.js";
2
5
  import {
3
6
  format,
4
7
  parseDateString
@@ -6,9 +9,6 @@ import {
6
9
  import {
7
10
  getEndOfDay
8
11
  } from "../chunk-Q2EFMBMD.js";
9
- import {
10
- hourFormat
11
- } from "../chunk-UCF3YRN2.js";
12
12
  import "../chunk-MLKGABMK.js";
13
13
  export {
14
14
  format,
package/dist/index.cjs CHANGED
@@ -61,6 +61,10 @@ require('./chunk-YGJOBIEO.cjs');
61
61
  require('./chunk-ZZEFL2TE.cjs');
62
62
 
63
63
 
64
+ var _chunk5SOPYS7Lcjs = require('./chunk-5SOPYS7L.cjs');
65
+ require('./chunk-Z2EAQZ47.cjs');
66
+
67
+
64
68
  var _chunkZUIHJQD6cjs = require('./chunk-ZUIHJQD6.cjs');
65
69
  require('./chunk-2OR4FUOA.cjs');
66
70
  require('./chunk-EOJVE3HL.cjs');
@@ -69,24 +73,22 @@ require('./chunk-E2MM4MEC.cjs');
69
73
  require('./chunk-6TBH7RAC.cjs');
70
74
 
71
75
 
72
- var _chunk4MF6LYYScjs = require('./chunk-4MF6LYYS.cjs');
73
- require('./chunk-4X7AFGTV.cjs');
74
- require('./chunk-LTVXRDTD.cjs');
75
- require('./chunk-HJTIJGIF.cjs');
76
- require('./chunk-VY5VQ7WE.cjs');
77
- require('./chunk-UGS2F6DK.cjs');
78
- require('./chunk-IFVVMDAW.cjs');
79
- require('./chunk-6TH2K7LE.cjs');
76
+ var _chunkXDTLZL44cjs = require('./chunk-XDTLZL44.cjs');
80
77
  require('./chunk-SJPWB2OH.cjs');
81
78
  require('./chunk-GFAUQTB2.cjs');
82
79
  require('./chunk-CTLBHJGF.cjs');
80
+ require('./chunk-4X7AFGTV.cjs');
81
+ require('./chunk-LTVXRDTD.cjs');
82
+ require('./chunk-HJTIJGIF.cjs');
83
+ require('./chunk-7TGGIID4.cjs');
84
+ require('./chunk-75UYCE4X.cjs');
83
85
 
84
86
 
85
- var _chunkLHJNQXELcjs = require('./chunk-LHJNQXEL.cjs');
86
- require('./chunk-L4JXPCBW.cjs');
87
+ var _chunkTV763MO4cjs = require('./chunk-TV763MO4.cjs');
88
+ require('./chunk-XLYPGPDB.cjs');
87
89
  require('./chunk-ZZKR5C3Y.cjs');
88
90
  require('./chunk-K2XKKEE7.cjs');
89
- require('./chunk-SHT5THEZ.cjs');
91
+ require('./chunk-TKE7IK2M.cjs');
90
92
  require('./chunk-HLKHFBMF.cjs');
91
93
  require('./chunk-HWHYHL6J.cjs');
92
94
  require('./chunk-J7S3KBHL.cjs');
@@ -125,14 +127,12 @@ require('./chunk-WWAPPA4E.cjs');
125
127
  require('./chunk-A5LHXE5X.cjs');
126
128
  require('./chunk-MIC3W2VY.cjs');
127
129
  require('./chunk-ISHLY7WM.cjs');
128
-
129
-
130
- var _chunk7NEXCOZZcjs = require('./chunk-7NEXCOZZ.cjs');
131
- require('./chunk-7TGGIID4.cjs');
132
- require('./chunk-75UYCE4X.cjs');
133
- require('./chunk-Z2EAQZ47.cjs');
134
130
  require('./chunk-UGFSIZ5P.cjs');
135
131
  require('./chunk-TE3XNGF4.cjs');
132
+ require('./chunk-VY5VQ7WE.cjs');
133
+ require('./chunk-UGS2F6DK.cjs');
134
+ require('./chunk-IFVVMDAW.cjs');
135
+ require('./chunk-6TH2K7LE.cjs');
136
136
  require('./chunk-75ZPJI57.cjs');
137
137
 
138
138
 
@@ -149,4 +149,4 @@ require('./chunk-75ZPJI57.cjs');
149
149
 
150
150
 
151
151
 
152
- exports.basic = _chunkLHJNQXELcjs.basic_exports; exports.css = _chunk4MF6LYYScjs.css_exports; exports.date = _chunk7NEXCOZZcjs.date_exports; exports.dom = _chunkZUIHJQD6cjs.dom_exports; exports.html = _chunkFLGYKRQ6cjs.html_exports; exports.iss = _chunkRYVXUCAScjs.iss_exports; exports.judge = _chunkFL2HPQ66cjs.judge_exports; exports.load = _chunkBD6DK4QKcjs.load_exports; exports.log = _chunkHUKQYAV6cjs.log_exports; exports.name = _chunkBG2YS767cjs.name_exports; exports.node = _chunkV6PYRA4Acjs.node_exports; exports.tree = _chunkAPRM3ELYcjs.tree_exports; exports.urls = _chunk7GCUYESUcjs.urls_exports; exports.window = _chunk72GMBSE6cjs.window_exports;
152
+ exports.basic = _chunkTV763MO4cjs.basic_exports; exports.css = _chunkXDTLZL44cjs.css_exports; exports.date = _chunk5SOPYS7Lcjs.date_exports; exports.dom = _chunkZUIHJQD6cjs.dom_exports; exports.html = _chunkFLGYKRQ6cjs.html_exports; exports.iss = _chunkRYVXUCAScjs.iss_exports; exports.judge = _chunkFL2HPQ66cjs.judge_exports; exports.load = _chunkBD6DK4QKcjs.load_exports; exports.log = _chunkHUKQYAV6cjs.log_exports; exports.name = _chunkBG2YS767cjs.name_exports; exports.node = _chunkV6PYRA4Acjs.node_exports; exports.tree = _chunkAPRM3ELYcjs.tree_exports; exports.urls = _chunk7GCUYESUcjs.urls_exports; exports.window = _chunk72GMBSE6cjs.window_exports;
package/dist/index.js CHANGED
@@ -59,6 +59,10 @@ import "./chunk-33X65PQS.js";
59
59
  import "./chunk-IRGCP7KH.js";
60
60
  import "./chunk-YNOFNHEK.js";
61
61
  import "./chunk-S6JRKYPY.js";
62
+ import {
63
+ date_exports
64
+ } from "./chunk-H22VVRP6.js";
65
+ import "./chunk-UCF3YRN2.js";
62
66
  import {
63
67
  dom_exports
64
68
  } from "./chunk-Z3BZ5W5W.js";
@@ -69,24 +73,22 @@ import "./chunk-IV7XHH6K.js";
69
73
  import "./chunk-7PJ2D3KR.js";
70
74
  import {
71
75
  css_exports
72
- } from "./chunk-HWQYLP45.js";
73
- import "./chunk-XUL6LPTN.js";
74
- import "./chunk-J7CICTHH.js";
75
- import "./chunk-M323GS33.js";
76
- import "./chunk-MQHLAQQA.js";
77
- import "./chunk-5RZYHE3X.js";
78
- import "./chunk-KE77GEY2.js";
79
- import "./chunk-VNY5UA2Q.js";
76
+ } from "./chunk-M7CA6X7T.js";
80
77
  import "./chunk-NW2ZNMSV.js";
81
78
  import "./chunk-WIYZQNGO.js";
82
79
  import "./chunk-D3YMEKIF.js";
80
+ import "./chunk-XUL6LPTN.js";
81
+ import "./chunk-J7CICTHH.js";
82
+ import "./chunk-M323GS33.js";
83
+ import "./chunk-EKY7GXCD.js";
84
+ import "./chunk-Q2EFMBMD.js";
83
85
  import {
84
86
  basic_exports
85
- } from "./chunk-JLO73Y7O.js";
86
- import "./chunk-NL6Q47ZV.js";
87
+ } from "./chunk-F4E66MPZ.js";
88
+ import "./chunk-CGDNKEYI.js";
87
89
  import "./chunk-SE2X5XKO.js";
88
90
  import "./chunk-TIZFQBWC.js";
89
- import "./chunk-FIODV4DZ.js";
91
+ import "./chunk-ZADO6V3Z.js";
90
92
  import "./chunk-ADPTUJSF.js";
91
93
  import "./chunk-N5Y3XGHX.js";
92
94
  import "./chunk-7DTHADVK.js";
@@ -125,14 +127,12 @@ import "./chunk-BEKTNBRJ.js";
125
127
  import "./chunk-GYE23WAN.js";
126
128
  import "./chunk-MXY4W3K5.js";
127
129
  import "./chunk-5PX3AFSC.js";
128
- import {
129
- date_exports
130
- } from "./chunk-JPQN3LUH.js";
131
- import "./chunk-EKY7GXCD.js";
132
- import "./chunk-Q2EFMBMD.js";
133
- import "./chunk-UCF3YRN2.js";
134
130
  import "./chunk-WX3JYE47.js";
135
131
  import "./chunk-N3FZ4WUI.js";
132
+ import "./chunk-MQHLAQQA.js";
133
+ import "./chunk-5RZYHE3X.js";
134
+ import "./chunk-KE77GEY2.js";
135
+ import "./chunk-VNY5UA2Q.js";
136
136
  import "./chunk-MLKGABMK.js";
137
137
  export {
138
138
  basic_exports as basic,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fangzhongya/utils",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.0.63",
5
+ "version": "0.0.65",
6
6
  "description ": "个人工具库",
7
7
  "author": "fangzhongya ",
8
8
  "license": "MIT",
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunkZ2EAQZ47cjs = require('./chunk-Z2EAQZ47.cjs');
3
4
 
4
- var _chunk7TGGIID4cjs = require('./chunk-7TGGIID4.cjs');
5
5
 
6
6
 
7
- var _chunk75UYCE4Xcjs = require('./chunk-75UYCE4X.cjs');
7
+ var _chunk7TGGIID4cjs = require('./chunk-7TGGIID4.cjs');
8
8
 
9
9
 
10
- var _chunkZ2EAQZ47cjs = require('./chunk-Z2EAQZ47.cjs');
10
+ var _chunk75UYCE4Xcjs = require('./chunk-75UYCE4X.cjs');
11
11
 
12
12
 
13
13
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
@@ -1,3 +1,6 @@
1
+ import {
2
+ hourFormat
3
+ } from "./chunk-UCF3YRN2.js";
1
4
  import {
2
5
  format,
3
6
  parseDateString
@@ -5,9 +8,6 @@ import {
5
8
  import {
6
9
  getEndOfDay
7
10
  } from "./chunk-Q2EFMBMD.js";
8
- import {
9
- hourFormat
10
- } from "./chunk-UCF3YRN2.js";
11
11
  import {
12
12
  __export
13
13
  } from "./chunk-MLKGABMK.js";
@@ -1,3 +1,12 @@
1
+ import {
2
+ getScssImports
3
+ } from "./chunk-NW2ZNMSV.js";
4
+ import {
5
+ getSVG
6
+ } from "./chunk-WIYZQNGO.js";
7
+ import {
8
+ setClassName
9
+ } from "./chunk-D3YMEKIF.js";
1
10
  import {
2
11
  setCss
3
12
  } from "./chunk-XUL6LPTN.js";
@@ -5,6 +14,12 @@ import {
5
14
  setObjStyle,
6
15
  toStyleString
7
16
  } from "./chunk-M323GS33.js";
17
+ import {
18
+ fetchUnitValue
19
+ } from "./chunk-WX3JYE47.js";
20
+ import {
21
+ getAttrObj
22
+ } from "./chunk-N3FZ4WUI.js";
8
23
  import {
9
24
  getPositionRelative
10
25
  } from "./chunk-MQHLAQQA.js";
@@ -17,21 +32,6 @@ import {
17
32
  import {
18
33
  getPrentCorres
19
34
  } from "./chunk-VNY5UA2Q.js";
20
- import {
21
- getScssImports
22
- } from "./chunk-NW2ZNMSV.js";
23
- import {
24
- getSVG
25
- } from "./chunk-WIYZQNGO.js";
26
- import {
27
- setClassName
28
- } from "./chunk-D3YMEKIF.js";
29
- import {
30
- fetchUnitValue
31
- } from "./chunk-WX3JYE47.js";
32
- import {
33
- getAttrObj
34
- } from "./chunk-N3FZ4WUI.js";
35
35
  import {
36
36
  __export
37
37
  } from "./chunk-MLKGABMK.js";
@@ -1,37 +1,37 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk4X7AFGTVcjs = require('./chunk-4X7AFGTV.cjs');
3
+ var _chunkSJPWB2OHcjs = require('./chunk-SJPWB2OH.cjs');
4
4
 
5
5
 
6
+ var _chunkGFAUQTB2cjs = require('./chunk-GFAUQTB2.cjs');
6
7
 
7
- var _chunkHJTIJGIFcjs = require('./chunk-HJTIJGIF.cjs');
8
8
 
9
+ var _chunkCTLBHJGFcjs = require('./chunk-CTLBHJGF.cjs');
9
10
 
10
- var _chunkVY5VQ7WEcjs = require('./chunk-VY5VQ7WE.cjs');
11
11
 
12
+ var _chunk4X7AFGTVcjs = require('./chunk-4X7AFGTV.cjs');
12
13
 
13
- var _chunkUGS2F6DKcjs = require('./chunk-UGS2F6DK.cjs');
14
14
 
15
15
 
16
- var _chunkIFVVMDAWcjs = require('./chunk-IFVVMDAW.cjs');
16
+ var _chunkHJTIJGIFcjs = require('./chunk-HJTIJGIF.cjs');
17
17
 
18
18
 
19
- var _chunk6TH2K7LEcjs = require('./chunk-6TH2K7LE.cjs');
19
+ var _chunkUGFSIZ5Pcjs = require('./chunk-UGFSIZ5P.cjs');
20
20
 
21
21
 
22
- var _chunkSJPWB2OHcjs = require('./chunk-SJPWB2OH.cjs');
22
+ var _chunkTE3XNGF4cjs = require('./chunk-TE3XNGF4.cjs');
23
23
 
24
24
 
25
- var _chunkGFAUQTB2cjs = require('./chunk-GFAUQTB2.cjs');
25
+ var _chunkVY5VQ7WEcjs = require('./chunk-VY5VQ7WE.cjs');
26
26
 
27
27
 
28
- var _chunkCTLBHJGFcjs = require('./chunk-CTLBHJGF.cjs');
28
+ var _chunkUGS2F6DKcjs = require('./chunk-UGS2F6DK.cjs');
29
29
 
30
30
 
31
- var _chunkUGFSIZ5Pcjs = require('./chunk-UGFSIZ5P.cjs');
31
+ var _chunkIFVVMDAWcjs = require('./chunk-IFVVMDAW.cjs');
32
32
 
33
33
 
34
- var _chunkTE3XNGF4cjs = require('./chunk-TE3XNGF4.cjs');
34
+ var _chunk6TH2K7LEcjs = require('./chunk-6TH2K7LE.cjs');
35
35
 
36
36
 
37
37
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');