@fangzhongya/utils 0.0.27 → 0.0.28

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,9 +1,10 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-PPMTNMKL.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-CS3E5UZ2.cjs');
2
2
 
3
3
 
4
- var _chunkR73OUZSWcjs = require('../chunk-R73OUZSW.cjs');
4
+ var _chunk5J5H4CQIcjs = require('../chunk-5J5H4CQI.cjs');
5
5
  require('../chunk-JHV27P2Q.cjs');
6
6
  require('../chunk-ETMYYVQJ.cjs');
7
+ require('../chunk-XG44HG5N.cjs');
7
8
  require('../chunk-3GVTDRAE.cjs');
8
9
  require('../chunk-J7S3KBHL.cjs');
9
10
  require('../chunk-L7FSHU27.cjs');
@@ -46,4 +47,4 @@ require('../chunk-75ZPJI57.cjs');
46
47
 
47
48
 
48
49
 
49
- exports.array = _chunk4K5L3QJWcjs.array_exports; exports.object = _chunkUKUXUB64cjs.object_exports; exports.string = _chunkR73OUZSWcjs.string_exports;
50
+ exports.array = _chunk4K5L3QJWcjs.array_exports; exports.object = _chunkUKUXUB64cjs.object_exports; exports.string = _chunk5J5H4CQIcjs.string_exports;
@@ -1,6 +1,6 @@
1
1
  export { i as array } from '../index-qUiGxoy_.cjs';
2
2
  export { i as object } from '../index-BU0xla6v.cjs';
3
- export { i as string } from '../index-5Gw-pdd1.cjs';
3
+ export { i as string } from '../index-DaryquSt.cjs';
4
4
  import './array/asyncMergeArray.cjs';
5
5
  import './array/deleteArray.cjs';
6
6
  import './array/duplicateRemoval.cjs';
@@ -34,3 +34,4 @@ import './string/startsNum.cjs';
34
34
  import './string/toFunction.cjs';
35
35
  import './string/toJson.cjs';
36
36
  import './string/toJsons.cjs';
37
+ import './string/toStringParse.cjs';
@@ -1,6 +1,6 @@
1
1
  export { i as array } from '../index-C29DFVeC.js';
2
2
  export { i as object } from '../index-DOq59RNr.js';
3
- export { i as string } from '../index-CVrzXZU0.js';
3
+ export { i as string } from '../index-CmiMKPSL.js';
4
4
  import './array/asyncMergeArray.js';
5
5
  import './array/deleteArray.js';
6
6
  import './array/duplicateRemoval.js';
@@ -34,3 +34,4 @@ import './string/startsNum.js';
34
34
  import './string/toFunction.js';
35
35
  import './string/toJson.js';
36
36
  import './string/toJsons.js';
37
+ import './string/toStringParse.js';
@@ -1,9 +1,10 @@
1
- import "../chunk-W2AZSVCH.js";
1
+ import "../chunk-FROL42SM.js";
2
2
  import {
3
3
  string_exports
4
- } from "../chunk-YE2JQIXS.js";
4
+ } from "../chunk-SOHG7BA5.js";
5
5
  import "../chunk-U3PZBQ6G.js";
6
6
  import "../chunk-5HC662VK.js";
7
+ import "../chunk-MGK5PCGH.js";
7
8
  import "../chunk-DILPRD5C.js";
8
9
  import "../chunk-7DTHADVK.js";
9
10
  import "../chunk-VKE5JARB.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-R73OUZSW.cjs');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-5J5H4CQI.cjs');
2
2
 
3
3
 
4
4
 
@@ -11,6 +11,9 @@ var _chunkJHV27P2Qcjs = require('../../chunk-JHV27P2Q.cjs');
11
11
  var _chunkETMYYVQJcjs = require('../../chunk-ETMYYVQJ.cjs');
12
12
 
13
13
 
14
+ var _chunkXG44HG5Ncjs = require('../../chunk-XG44HG5N.cjs');
15
+
16
+
14
17
 
15
18
  var _chunk3GVTDRAEcjs = require('../../chunk-3GVTDRAE.cjs');
16
19
 
@@ -70,4 +73,5 @@ require('../../chunk-75ZPJI57.cjs');
70
73
 
71
74
 
72
75
 
73
- exports.appearNum = _chunkOJBZ7UUCcjs.appearNum; exports.appearNumSeat = _chunkJR6ZN6QDcjs.appearNumSeat; exports.deComment = _chunkXWCRGY54cjs.deComment; exports.firstLower = _chunkUEVMS6QDcjs.firstLower; exports.firstUpper = _chunkOQL4GIEJcjs.firstUpper; exports.getFunctionFormat = _chunkQXK4IUBIcjs.getFunctionFormat; exports.getImports = _chunk3GVTDRAEcjs.getImports; exports.getImportss = _chunk3GVTDRAEcjs.getImportss; exports.getStartSame = _chunkJ7S3KBHLcjs.getStartSame; exports.getStartSames = _chunkPW7RP73Jcjs.getStartSames; exports.getStrNunPosit = _chunk2H3KVSFAcjs.getStrNunPosit; exports.serializeCodeBlock = _chunkETMYYVQJcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkETMYYVQJcjs.serializeFunctionRef; exports.splitUpper = _chunkL7FSHU27cjs.splitUpper; exports.startsNum = _chunkILJLXJ5Ocjs.startsNum; exports.toFunction = _chunkQXK4IUBIcjs.toFunction; exports.toJSONParse = _chunkJHV27P2Qcjs.toJSONParse; exports.toJSONSParse = _chunkETMYYVQJcjs.toJSONSParse; exports.toJSONSStringify = _chunkETMYYVQJcjs.toJSONSStringify; exports.toJSONStringify = _chunkJHV27P2Qcjs.toJSONStringify;
76
+
77
+ exports.appearNum = _chunkOJBZ7UUCcjs.appearNum; exports.appearNumSeat = _chunkJR6ZN6QDcjs.appearNumSeat; exports.deComment = _chunkXWCRGY54cjs.deComment; exports.firstLower = _chunkUEVMS6QDcjs.firstLower; exports.firstUpper = _chunkOQL4GIEJcjs.firstUpper; exports.getFunctionFormat = _chunkQXK4IUBIcjs.getFunctionFormat; exports.getImports = _chunk3GVTDRAEcjs.getImports; exports.getImportss = _chunk3GVTDRAEcjs.getImportss; exports.getStartSame = _chunkJ7S3KBHLcjs.getStartSame; exports.getStartSames = _chunkPW7RP73Jcjs.getStartSames; exports.getStrNunPosit = _chunk2H3KVSFAcjs.getStrNunPosit; exports.serializeCodeBlock = _chunkETMYYVQJcjs.serializeCodeBlock; exports.serializeFunctionRef = _chunkETMYYVQJcjs.serializeFunctionRef; exports.splitUpper = _chunkL7FSHU27cjs.splitUpper; exports.startsNum = _chunkILJLXJ5Ocjs.startsNum; exports.toFunction = _chunkQXK4IUBIcjs.toFunction; exports.toJSONParse = _chunkJHV27P2Qcjs.toJSONParse; exports.toJSONSParse = _chunkETMYYVQJcjs.toJSONSParse; exports.toJSONSStringify = _chunkETMYYVQJcjs.toJSONSStringify; exports.toJSONStringify = _chunkJHV27P2Qcjs.toJSONStringify; exports.toStringParse = _chunkXG44HG5Ncjs.toStringParse;
@@ -12,3 +12,4 @@ export { startsNum } from './startsNum.cjs';
12
12
  export { getFunctionFormat, toFunction } from './toFunction.cjs';
13
13
  export { toJSONParse, toJSONStringify } from './toJson.cjs';
14
14
  export { CodeBlock, serializeCodeBlock, serializeFunctionRef, toJSONSParse, toJSONSStringify } from './toJsons.cjs';
15
+ export { toStringParse } from './toStringParse.cjs';
@@ -12,3 +12,4 @@ export { startsNum } from './startsNum.js';
12
12
  export { getFunctionFormat, toFunction } from './toFunction.js';
13
13
  export { toJSONParse, toJSONStringify } from './toJson.js';
14
14
  export { CodeBlock, serializeCodeBlock, serializeFunctionRef, toJSONSParse, toJSONSStringify } from './toJsons.js';
15
+ export { toStringParse } from './toStringParse.js';
@@ -1,4 +1,4 @@
1
- import "../../chunk-YE2JQIXS.js";
1
+ import "../../chunk-SOHG7BA5.js";
2
2
  import {
3
3
  toJSONParse,
4
4
  toJSONStringify
@@ -9,6 +9,9 @@ import {
9
9
  toJSONSParse,
10
10
  toJSONSStringify
11
11
  } from "../../chunk-5HC662VK.js";
12
+ import {
13
+ toStringParse
14
+ } from "../../chunk-MGK5PCGH.js";
12
15
  import {
13
16
  getImports,
14
17
  getImportss
@@ -69,5 +72,6 @@ export {
69
72
  toJSONParse,
70
73
  toJSONSParse,
71
74
  toJSONSStringify,
72
- toJSONStringify
75
+ toJSONStringify,
76
+ toStringParse
73
77
  };
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkXG44HG5Ncjs = require('../../chunk-XG44HG5N.cjs');
4
+ require('../../chunk-QXK4IUBI.cjs');
5
+ require('../../chunk-75ZPJI57.cjs');
6
+
7
+
8
+ exports.toStringParse = _chunkXG44HG5Ncjs.toStringParse;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 安全反序列化函数(完整支持更多内置对象)
3
+ */
4
+ declare function toStringParse(str: string, type: string, split?: string | RegExp): any;
5
+
6
+ export { toStringParse };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 安全反序列化函数(完整支持更多内置对象)
3
+ */
4
+ declare function toStringParse(str: string, type: string, split?: string | RegExp): any;
5
+
6
+ export { toStringParse };
@@ -0,0 +1,8 @@
1
+ import {
2
+ toStringParse
3
+ } from "../../chunk-MGK5PCGH.js";
4
+ import "../../chunk-7O4MJOHM.js";
5
+ import "../../chunk-MLKGABMK.js";
6
+ export {
7
+ toStringParse
8
+ };
@@ -10,6 +10,9 @@ var _chunkJHV27P2Qcjs = require('./chunk-JHV27P2Q.cjs');
10
10
  var _chunkETMYYVQJcjs = require('./chunk-ETMYYVQJ.cjs');
11
11
 
12
12
 
13
+ var _chunkXG44HG5Ncjs = require('./chunk-XG44HG5N.cjs');
14
+
15
+
13
16
 
14
17
  var _chunk3GVTDRAEcjs = require('./chunk-3GVTDRAE.cjs');
15
18
 
@@ -72,7 +75,8 @@ _chunk75ZPJI57cjs.__export.call(void 0, string_exports, {
72
75
  toJSONParse: () => _chunkJHV27P2Qcjs.toJSONParse,
73
76
  toJSONSParse: () => _chunkETMYYVQJcjs.toJSONSParse,
74
77
  toJSONSStringify: () => _chunkETMYYVQJcjs.toJSONSStringify,
75
- toJSONStringify: () => _chunkJHV27P2Qcjs.toJSONStringify
78
+ toJSONStringify: () => _chunkJHV27P2Qcjs.toJSONStringify,
79
+ toStringParse: () => _chunkXG44HG5Ncjs.toStringParse
76
80
  });
77
81
 
78
82
 
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkR73OUZSWcjs = require('./chunk-R73OUZSW.cjs');
3
+ var _chunk5J5H4CQIcjs = require('./chunk-5J5H4CQI.cjs');
4
4
 
5
5
 
6
6
  var _chunkUKUXUB64cjs = require('./chunk-UKUXUB64.cjs');
@@ -16,7 +16,7 @@ var basic_exports = {};
16
16
  _chunk75ZPJI57cjs.__export.call(void 0, basic_exports, {
17
17
  array: () => _chunk4K5L3QJWcjs.array_exports,
18
18
  object: () => _chunkUKUXUB64cjs.object_exports,
19
- string: () => _chunkR73OUZSWcjs.string_exports
19
+ string: () => _chunk5J5H4CQIcjs.string_exports
20
20
  });
21
21
 
22
22
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  string_exports
3
- } from "./chunk-YE2JQIXS.js";
3
+ } from "./chunk-SOHG7BA5.js";
4
4
  import {
5
5
  object_exports
6
6
  } from "./chunk-MECBPLFH.js";
@@ -0,0 +1,191 @@
1
+ import {
2
+ toFunction
3
+ } from "./chunk-7O4MJOHM.js";
4
+
5
+ // packages/basic/string/toStringParse.ts
6
+ var arrayBufferUtils = {
7
+ // 将ArrayBuffer编码为Base64字符串
8
+ encode: (buffer) => {
9
+ if (typeof Buffer !== "undefined") {
10
+ const bytes = new Uint8Array(buffer);
11
+ let binary = "";
12
+ bytes.forEach((byte) => binary += String.fromCharCode(byte));
13
+ return btoa(binary);
14
+ }
15
+ if (typeof btoa === "function") {
16
+ const bytes = new Uint8Array(buffer);
17
+ let binary = "";
18
+ for (let i = 0; i < bytes.byteLength; i++) {
19
+ binary += String.fromCharCode(bytes[i]);
20
+ }
21
+ return btoa(binary);
22
+ }
23
+ throw new Error(
24
+ "ArrayBuffer encoding not supported in this environment"
25
+ );
26
+ },
27
+ // 将Base64字符串解码为ArrayBuffer
28
+ decode: (base64Str) => {
29
+ if (typeof Buffer !== "undefined") {
30
+ const binaryString = atob(base64Str);
31
+ const bytes = new Uint8Array(binaryString.length);
32
+ for (let i = 0; i < binaryString.length; i++) {
33
+ bytes[i] = binaryString.charCodeAt(i);
34
+ }
35
+ return bytes.buffer;
36
+ }
37
+ if (typeof atob === "function") {
38
+ const binaryString = atob(base64Str);
39
+ const bytes = new Uint8Array(binaryString.length);
40
+ for (let i = 0; i < binaryString.length; i++) {
41
+ bytes[i] = binaryString.charCodeAt(i);
42
+ }
43
+ return bytes.buffer;
44
+ }
45
+ throw new Error(
46
+ "ArrayBuffer decoding not supported in this environment"
47
+ );
48
+ },
49
+ // 获取ArrayBuffer的字节数组表示
50
+ toByteArray: (buffer) => {
51
+ return Array.from(new Uint8Array(buffer));
52
+ },
53
+ // 从字节数组创建ArrayBuffer
54
+ fromByteArray: (array) => {
55
+ const buffer = new ArrayBuffer(array.length);
56
+ const view = new Uint8Array(buffer);
57
+ array.forEach((value, index) => view[index] = value);
58
+ return buffer;
59
+ }
60
+ };
61
+ function toStringParse(str, type, split = ",") {
62
+ try {
63
+ type = type.toLowerCase();
64
+ switch (type) {
65
+ case "string":
66
+ return str;
67
+ case "number":
68
+ return Number(str);
69
+ case "null":
70
+ return null;
71
+ case "boolean":
72
+ return Boolean(str);
73
+ case "function":
74
+ return toFunction(str) || function() {
75
+ };
76
+ case "undefined":
77
+ return void 0;
78
+ case "array":
79
+ return JSON.parse(str);
80
+ case "map": {
81
+ const v = JSON.parse(str);
82
+ const map = /* @__PURE__ */ new Map();
83
+ if (v instanceof Array) {
84
+ for (let value of v) {
85
+ map.set(value[0], value[1]);
86
+ }
87
+ } else {
88
+ Object.keys(v).forEach((k) => {
89
+ map.set(k, v[k]);
90
+ });
91
+ }
92
+ return map;
93
+ }
94
+ case "set": {
95
+ const v = JSON.parse(str);
96
+ return new Set(...v);
97
+ }
98
+ case "object":
99
+ return JSON.parse(str);
100
+ case "symbol":
101
+ return Symbol(str);
102
+ case "nan":
103
+ return NaN;
104
+ case "date":
105
+ return new Date(str);
106
+ case "regexp": {
107
+ const e = str.split(split);
108
+ return new RegExp(e[0], e[1]);
109
+ }
110
+ case "infinity":
111
+ return Infinity;
112
+ case "-infinity":
113
+ return -Infinity;
114
+ case "bigint":
115
+ return BigInt(str);
116
+ case "arraybuffer":
117
+ return arrayBufferUtils.decode(str);
118
+ case "error": {
119
+ const e = str.split(split);
120
+ const error = new Error(e[0]);
121
+ error.name = e[1];
122
+ error.stack = e[2];
123
+ return error;
124
+ }
125
+ case "url":
126
+ return new URL(str);
127
+ // 处理所有TypedArray类型
128
+ case "int8array": {
129
+ const arr = str.split(split).map((o) => Number(o));
130
+ return new Int8Array(arrayBufferUtils.fromByteArray(arr));
131
+ }
132
+ case "uint8array": {
133
+ const arr = str.split(split).map((o) => Number(o));
134
+ return new Uint8Array(arrayBufferUtils.fromByteArray(arr));
135
+ }
136
+ case "uint8clampedarray": {
137
+ const arr = str.split(split).map((o) => Number(o));
138
+ return new Uint8ClampedArray(
139
+ arrayBufferUtils.fromByteArray(arr)
140
+ );
141
+ }
142
+ case "int16array": {
143
+ const arr = str.split(split).map((o) => Number(o));
144
+ return new Int16Array(arrayBufferUtils.fromByteArray(arr));
145
+ }
146
+ case "bigint64array": {
147
+ const arr = str.split(split).map((o) => Number(o));
148
+ return new BigInt64Array(arrayBufferUtils.fromByteArray(arr));
149
+ }
150
+ case "biguint64array": {
151
+ const arr = str.split(split).map((o) => Number(o));
152
+ return new BigUint64Array(arrayBufferUtils.fromByteArray(arr));
153
+ }
154
+ case "float64array": {
155
+ const arr = str.split(split).map((o) => Number(o));
156
+ return new Float64Array(arrayBufferUtils.fromByteArray(arr));
157
+ }
158
+ case "float32array": {
159
+ const arr = str.split(split).map((o) => Number(o));
160
+ return new Float32Array(arrayBufferUtils.fromByteArray(arr));
161
+ }
162
+ case "uint32array": {
163
+ const arr = str.split(split).map((o) => Number(o));
164
+ return new Uint32Array(arrayBufferUtils.fromByteArray(arr));
165
+ }
166
+ case "int32array": {
167
+ const arr = str.split(split).map((o) => Number(o));
168
+ return new Int32Array(arrayBufferUtils.fromByteArray(arr));
169
+ }
170
+ case "uint16array": {
171
+ const arr = str.split(split).map((o) => Number(o));
172
+ return new Uint16Array(arrayBufferUtils.fromByteArray(arr));
173
+ }
174
+ case "dataview": {
175
+ const d = str.split(split);
176
+ const buffer = arrayBufferUtils.decode(d[0]);
177
+ return new DataView(buffer, Number(d[1]), Number(d[2]));
178
+ }
179
+ }
180
+ } catch (error) {
181
+ console.error("JSON parse error:", {
182
+ str: str.slice(0, 200) + "...",
183
+ error
184
+ });
185
+ return str;
186
+ }
187
+ }
188
+
189
+ export {
190
+ toStringParse
191
+ };
@@ -8,6 +8,9 @@ import {
8
8
  toJSONSParse,
9
9
  toJSONSStringify
10
10
  } from "./chunk-5HC662VK.js";
11
+ import {
12
+ toStringParse
13
+ } from "./chunk-MGK5PCGH.js";
11
14
  import {
12
15
  getImports,
13
16
  getImportss
@@ -72,7 +75,8 @@ __export(string_exports, {
72
75
  toJSONParse: () => toJSONParse,
73
76
  toJSONSParse: () => toJSONSParse,
74
77
  toJSONSStringify: () => toJSONSStringify,
75
- toJSONStringify: () => toJSONStringify
78
+ toJSONStringify: () => toJSONStringify,
79
+ toStringParse: () => toStringParse
76
80
  });
77
81
 
78
82
  export {
@@ -0,0 +1,191 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
4
+
5
+ // packages/basic/string/toStringParse.ts
6
+ var arrayBufferUtils = {
7
+ // 将ArrayBuffer编码为Base64字符串
8
+ encode: (buffer) => {
9
+ if (typeof Buffer !== "undefined") {
10
+ const bytes = new Uint8Array(buffer);
11
+ let binary = "";
12
+ bytes.forEach((byte) => binary += String.fromCharCode(byte));
13
+ return btoa(binary);
14
+ }
15
+ if (typeof btoa === "function") {
16
+ const bytes = new Uint8Array(buffer);
17
+ let binary = "";
18
+ for (let i = 0; i < bytes.byteLength; i++) {
19
+ binary += String.fromCharCode(bytes[i]);
20
+ }
21
+ return btoa(binary);
22
+ }
23
+ throw new Error(
24
+ "ArrayBuffer encoding not supported in this environment"
25
+ );
26
+ },
27
+ // 将Base64字符串解码为ArrayBuffer
28
+ decode: (base64Str) => {
29
+ if (typeof Buffer !== "undefined") {
30
+ const binaryString = atob(base64Str);
31
+ const bytes = new Uint8Array(binaryString.length);
32
+ for (let i = 0; i < binaryString.length; i++) {
33
+ bytes[i] = binaryString.charCodeAt(i);
34
+ }
35
+ return bytes.buffer;
36
+ }
37
+ if (typeof atob === "function") {
38
+ const binaryString = atob(base64Str);
39
+ const bytes = new Uint8Array(binaryString.length);
40
+ for (let i = 0; i < binaryString.length; i++) {
41
+ bytes[i] = binaryString.charCodeAt(i);
42
+ }
43
+ return bytes.buffer;
44
+ }
45
+ throw new Error(
46
+ "ArrayBuffer decoding not supported in this environment"
47
+ );
48
+ },
49
+ // 获取ArrayBuffer的字节数组表示
50
+ toByteArray: (buffer) => {
51
+ return Array.from(new Uint8Array(buffer));
52
+ },
53
+ // 从字节数组创建ArrayBuffer
54
+ fromByteArray: (array) => {
55
+ const buffer = new ArrayBuffer(array.length);
56
+ const view = new Uint8Array(buffer);
57
+ array.forEach((value, index) => view[index] = value);
58
+ return buffer;
59
+ }
60
+ };
61
+ function toStringParse(str, type, split = ",") {
62
+ try {
63
+ type = type.toLowerCase();
64
+ switch (type) {
65
+ case "string":
66
+ return str;
67
+ case "number":
68
+ return Number(str);
69
+ case "null":
70
+ return null;
71
+ case "boolean":
72
+ return Boolean(str);
73
+ case "function":
74
+ return _chunkQXK4IUBIcjs.toFunction.call(void 0, str) || function() {
75
+ };
76
+ case "undefined":
77
+ return void 0;
78
+ case "array":
79
+ return JSON.parse(str);
80
+ case "map": {
81
+ const v = JSON.parse(str);
82
+ const map = /* @__PURE__ */ new Map();
83
+ if (v instanceof Array) {
84
+ for (let value of v) {
85
+ map.set(value[0], value[1]);
86
+ }
87
+ } else {
88
+ Object.keys(v).forEach((k) => {
89
+ map.set(k, v[k]);
90
+ });
91
+ }
92
+ return map;
93
+ }
94
+ case "set": {
95
+ const v = JSON.parse(str);
96
+ return new Set(...v);
97
+ }
98
+ case "object":
99
+ return JSON.parse(str);
100
+ case "symbol":
101
+ return Symbol(str);
102
+ case "nan":
103
+ return NaN;
104
+ case "date":
105
+ return new Date(str);
106
+ case "regexp": {
107
+ const e = str.split(split);
108
+ return new RegExp(e[0], e[1]);
109
+ }
110
+ case "infinity":
111
+ return Infinity;
112
+ case "-infinity":
113
+ return -Infinity;
114
+ case "bigint":
115
+ return BigInt(str);
116
+ case "arraybuffer":
117
+ return arrayBufferUtils.decode(str);
118
+ case "error": {
119
+ const e = str.split(split);
120
+ const error = new Error(e[0]);
121
+ error.name = e[1];
122
+ error.stack = e[2];
123
+ return error;
124
+ }
125
+ case "url":
126
+ return new URL(str);
127
+ // 处理所有TypedArray类型
128
+ case "int8array": {
129
+ const arr = str.split(split).map((o) => Number(o));
130
+ return new Int8Array(arrayBufferUtils.fromByteArray(arr));
131
+ }
132
+ case "uint8array": {
133
+ const arr = str.split(split).map((o) => Number(o));
134
+ return new Uint8Array(arrayBufferUtils.fromByteArray(arr));
135
+ }
136
+ case "uint8clampedarray": {
137
+ const arr = str.split(split).map((o) => Number(o));
138
+ return new Uint8ClampedArray(
139
+ arrayBufferUtils.fromByteArray(arr)
140
+ );
141
+ }
142
+ case "int16array": {
143
+ const arr = str.split(split).map((o) => Number(o));
144
+ return new Int16Array(arrayBufferUtils.fromByteArray(arr));
145
+ }
146
+ case "bigint64array": {
147
+ const arr = str.split(split).map((o) => Number(o));
148
+ return new BigInt64Array(arrayBufferUtils.fromByteArray(arr));
149
+ }
150
+ case "biguint64array": {
151
+ const arr = str.split(split).map((o) => Number(o));
152
+ return new BigUint64Array(arrayBufferUtils.fromByteArray(arr));
153
+ }
154
+ case "float64array": {
155
+ const arr = str.split(split).map((o) => Number(o));
156
+ return new Float64Array(arrayBufferUtils.fromByteArray(arr));
157
+ }
158
+ case "float32array": {
159
+ const arr = str.split(split).map((o) => Number(o));
160
+ return new Float32Array(arrayBufferUtils.fromByteArray(arr));
161
+ }
162
+ case "uint32array": {
163
+ const arr = str.split(split).map((o) => Number(o));
164
+ return new Uint32Array(arrayBufferUtils.fromByteArray(arr));
165
+ }
166
+ case "int32array": {
167
+ const arr = str.split(split).map((o) => Number(o));
168
+ return new Int32Array(arrayBufferUtils.fromByteArray(arr));
169
+ }
170
+ case "uint16array": {
171
+ const arr = str.split(split).map((o) => Number(o));
172
+ return new Uint16Array(arrayBufferUtils.fromByteArray(arr));
173
+ }
174
+ case "dataview": {
175
+ const d = str.split(split);
176
+ const buffer = arrayBufferUtils.decode(d[0]);
177
+ return new DataView(buffer, Number(d[1]), Number(d[2]));
178
+ }
179
+ }
180
+ } catch (error) {
181
+ console.error("JSON parse error:", {
182
+ str: str.slice(0, 200) + "...",
183
+ error
184
+ });
185
+ return str;
186
+ }
187
+ }
188
+
189
+
190
+
191
+ exports.toStringParse = toStringParse;
@@ -1,6 +1,6 @@
1
1
  import { i as index$1 } from './index-C29DFVeC.js';
2
2
  import { i as index$2 } from './index-DOq59RNr.js';
3
- import { i as index$3 } from './index-CVrzXZU0.js';
3
+ import { i as index$3 } from './index-CmiMKPSL.js';
4
4
 
5
5
  declare namespace index {
6
6
  export { index$1 as array, index$2 as object, index$3 as string };
@@ -12,6 +12,7 @@ import { startsNum } from './basic/string/startsNum.js';
12
12
  import { getFunctionFormat, toFunction } from './basic/string/toFunction.js';
13
13
  import { toJSONParse, toJSONStringify } from './basic/string/toJson.js';
14
14
  import { CodeBlock, serializeCodeBlock, serializeFunctionRef, toJSONSParse, toJSONSStringify } from './basic/string/toJsons.js';
15
+ import { toStringParse } from './basic/string/toStringParse.js';
15
16
 
16
17
  declare const index_CodeBlock: typeof CodeBlock;
17
18
  declare const index_appearNum: typeof appearNum;
@@ -34,8 +35,9 @@ declare const index_toJSONParse: typeof toJSONParse;
34
35
  declare const index_toJSONSParse: typeof toJSONSParse;
35
36
  declare const index_toJSONSStringify: typeof toJSONSStringify;
36
37
  declare const index_toJSONStringify: typeof toJSONStringify;
38
+ declare const index_toStringParse: typeof toStringParse;
37
39
  declare namespace index {
38
- export { index_CodeBlock as CodeBlock, index_appearNum as appearNum, index_appearNumSeat as appearNumSeat, index_deComment as deComment, index_firstLower as firstLower, index_firstUpper as firstUpper, index_getFunctionFormat as getFunctionFormat, index_getImports as getImports, index_getImportss as getImportss, index_getStartSame as getStartSame, index_getStartSames as getStartSames, index_getStrNunPosit as getStrNunPosit, index_serializeCodeBlock as serializeCodeBlock, index_serializeFunctionRef as serializeFunctionRef, index_splitUpper as splitUpper, index_startsNum as startsNum, index_toFunction as toFunction, index_toJSONParse as toJSONParse, index_toJSONSParse as toJSONSParse, index_toJSONSStringify as toJSONSStringify, index_toJSONStringify as toJSONStringify };
40
+ export { index_CodeBlock as CodeBlock, index_appearNum as appearNum, index_appearNumSeat as appearNumSeat, index_deComment as deComment, index_firstLower as firstLower, index_firstUpper as firstUpper, index_getFunctionFormat as getFunctionFormat, index_getImports as getImports, index_getImportss as getImportss, index_getStartSame as getStartSame, index_getStartSames as getStartSames, index_getStrNunPosit as getStrNunPosit, index_serializeCodeBlock as serializeCodeBlock, index_serializeFunctionRef as serializeFunctionRef, index_splitUpper as splitUpper, index_startsNum as startsNum, index_toFunction as toFunction, index_toJSONParse as toJSONParse, index_toJSONSParse as toJSONSParse, index_toJSONSStringify as toJSONSStringify, index_toJSONStringify as toJSONStringify, index_toStringParse as toStringParse };
39
41
  }
40
42
 
41
43
  export { index as i };
@@ -12,6 +12,7 @@ import { startsNum } from './basic/string/startsNum.cjs';
12
12
  import { getFunctionFormat, toFunction } from './basic/string/toFunction.cjs';
13
13
  import { toJSONParse, toJSONStringify } from './basic/string/toJson.cjs';
14
14
  import { CodeBlock, serializeCodeBlock, serializeFunctionRef, toJSONSParse, toJSONSStringify } from './basic/string/toJsons.cjs';
15
+ import { toStringParse } from './basic/string/toStringParse.cjs';
15
16
 
16
17
  declare const index_CodeBlock: typeof CodeBlock;
17
18
  declare const index_appearNum: typeof appearNum;
@@ -34,8 +35,9 @@ declare const index_toJSONParse: typeof toJSONParse;
34
35
  declare const index_toJSONSParse: typeof toJSONSParse;
35
36
  declare const index_toJSONSStringify: typeof toJSONSStringify;
36
37
  declare const index_toJSONStringify: typeof toJSONStringify;
38
+ declare const index_toStringParse: typeof toStringParse;
37
39
  declare namespace index {
38
- export { index_CodeBlock as CodeBlock, index_appearNum as appearNum, index_appearNumSeat as appearNumSeat, index_deComment as deComment, index_firstLower as firstLower, index_firstUpper as firstUpper, index_getFunctionFormat as getFunctionFormat, index_getImports as getImports, index_getImportss as getImportss, index_getStartSame as getStartSame, index_getStartSames as getStartSames, index_getStrNunPosit as getStrNunPosit, index_serializeCodeBlock as serializeCodeBlock, index_serializeFunctionRef as serializeFunctionRef, index_splitUpper as splitUpper, index_startsNum as startsNum, index_toFunction as toFunction, index_toJSONParse as toJSONParse, index_toJSONSParse as toJSONSParse, index_toJSONSStringify as toJSONSStringify, index_toJSONStringify as toJSONStringify };
40
+ export { index_CodeBlock as CodeBlock, index_appearNum as appearNum, index_appearNumSeat as appearNumSeat, index_deComment as deComment, index_firstLower as firstLower, index_firstUpper as firstUpper, index_getFunctionFormat as getFunctionFormat, index_getImports as getImports, index_getImportss as getImportss, index_getStartSame as getStartSame, index_getStartSames as getStartSames, index_getStrNunPosit as getStrNunPosit, index_serializeCodeBlock as serializeCodeBlock, index_serializeFunctionRef as serializeFunctionRef, index_splitUpper as splitUpper, index_startsNum as startsNum, index_toFunction as toFunction, index_toJSONParse as toJSONParse, index_toJSONSParse as toJSONSParse, index_toJSONSStringify as toJSONSStringify, index_toJSONStringify as toJSONStringify, index_toStringParse as toStringParse };
39
41
  }
40
42
 
41
43
  export { index as i };
@@ -1,6 +1,6 @@
1
1
  import { i as index$1 } from './index-qUiGxoy_.cjs';
2
2
  import { i as index$2 } from './index-BU0xla6v.cjs';
3
- import { i as index$3 } from './index-5Gw-pdd1.cjs';
3
+ import { i as index$3 } from './index-DaryquSt.cjs';
4
4
 
5
5
  declare namespace index {
6
6
  export { index$1 as array, index$2 as object, index$3 as string };
package/dist/index.cjs CHANGED
@@ -18,13 +18,13 @@ require('./chunk-6A6EAFGL.cjs');
18
18
  require('./chunk-CP2ZSRMU.cjs');
19
19
 
20
20
 
21
+ var _chunkV6PYRA4Acjs = require('./chunk-V6PYRA4A.cjs');
22
+ require('./chunk-FGQXKLTH.cjs');
23
+
24
+
21
25
  var _chunkPV2N6PF2cjs = require('./chunk-PV2N6PF2.cjs');
22
26
  require('./chunk-YAD5PHVF.cjs');
23
27
  require('./chunk-RYBJGHXK.cjs');
24
-
25
-
26
- var _chunkV6PYRA4Acjs = require('./chunk-V6PYRA4A.cjs');
27
- require('./chunk-FGQXKLTH.cjs');
28
28
  require('./chunk-IRKWYW5B.cjs');
29
29
 
30
30
 
@@ -80,10 +80,11 @@ var _chunkFVQTU3A7cjs = require('./chunk-FVQTU3A7.cjs');
80
80
  require('./chunk-QDQ6QSZM.cjs');
81
81
 
82
82
 
83
- var _chunkPPMTNMKLcjs = require('./chunk-PPMTNMKL.cjs');
84
- require('./chunk-R73OUZSW.cjs');
83
+ var _chunkCS3E5UZ2cjs = require('./chunk-CS3E5UZ2.cjs');
84
+ require('./chunk-5J5H4CQI.cjs');
85
85
  require('./chunk-JHV27P2Q.cjs');
86
86
  require('./chunk-ETMYYVQJ.cjs');
87
+ require('./chunk-XG44HG5N.cjs');
87
88
  require('./chunk-3GVTDRAE.cjs');
88
89
  require('./chunk-J7S3KBHL.cjs');
89
90
  require('./chunk-L7FSHU27.cjs');
@@ -139,4 +140,4 @@ require('./chunk-75ZPJI57.cjs');
139
140
 
140
141
 
141
142
 
142
- exports.basic = _chunkPPMTNMKLcjs.basic_exports; exports.css = _chunkXDTLZL44cjs.css_exports; exports.date = _chunkFVQTU3A7cjs.date_exports; exports.dom = _chunkKNTGZRPDcjs.dom_exports; exports.html = _chunkQN6KZWKMcjs.html_exports; exports.iss = _chunkIJDVZOVJcjs.iss_exports; exports.judge = _chunkUHKL2RG3cjs.judge_exports; exports.load = _chunkXXS5G6S6cjs.load_exports; exports.log = _chunkHUKQYAV6cjs.log_exports; exports.name = _chunkBG2YS767cjs.name_exports; exports.node = _chunkV6PYRA4Acjs.node_exports; exports.tree = _chunkPV2N6PF2cjs.tree_exports; exports.urls = _chunkJZQA6OH4cjs.urls_exports; exports.window = _chunkVCQOLLVKcjs.window_exports;
143
+ exports.basic = _chunkCS3E5UZ2cjs.basic_exports; exports.css = _chunkXDTLZL44cjs.css_exports; exports.date = _chunkFVQTU3A7cjs.date_exports; exports.dom = _chunkKNTGZRPDcjs.dom_exports; exports.html = _chunkQN6KZWKMcjs.html_exports; exports.iss = _chunkIJDVZOVJcjs.iss_exports; exports.judge = _chunkUHKL2RG3cjs.judge_exports; exports.load = _chunkXXS5G6S6cjs.load_exports; exports.log = _chunkHUKQYAV6cjs.log_exports; exports.name = _chunkBG2YS767cjs.name_exports; exports.node = _chunkV6PYRA4Acjs.node_exports; exports.tree = _chunkPV2N6PF2cjs.tree_exports; exports.urls = _chunkJZQA6OH4cjs.urls_exports; exports.window = _chunkVCQOLLVKcjs.window_exports;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as basic } from './index-ClzD7A8u.cjs';
1
+ export { i as basic } from './index-Dmv6PGiQ.cjs';
2
2
  export { i as css } from './index-C0q7yBX5.cjs';
3
3
  export { i as date } from './index-CsYVH5m1.cjs';
4
4
  export { i as dom } from './index-BiHaQlE9.cjs';
@@ -33,7 +33,7 @@ import './basic/object/objValue.cjs';
33
33
  import './basic/object/reverseObj.cjs';
34
34
  import './basic/object/setSort.cjs';
35
35
  import './basic/object/unmergeObject.cjs';
36
- import './index-5Gw-pdd1.cjs';
36
+ import './index-DaryquSt.cjs';
37
37
  import './basic/string/appearNum.cjs';
38
38
  import './basic/string/appearNumSeat.cjs';
39
39
  import './basic/string/deComment.cjs';
@@ -48,6 +48,7 @@ import './basic/string/startsNum.cjs';
48
48
  import './basic/string/toFunction.cjs';
49
49
  import './basic/string/toJson.cjs';
50
50
  import './basic/string/toJsons.cjs';
51
+ import './basic/string/toStringParse.cjs';
51
52
  import './css/fetchUnitValue.cjs';
52
53
  import './css/getAttrObj.cjs';
53
54
  import './css/getCss.cjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { i as basic } from './index-VbgOqtuF.js';
1
+ export { i as basic } from './index-Br7o4Zbz.js';
2
2
  export { i as css } from './index-Bq6WKjlK.js';
3
3
  export { i as date } from './index-C1rfQdS-.js';
4
4
  export { i as dom } from './index-BqhKBGyX.js';
@@ -33,7 +33,7 @@ import './basic/object/objValue.js';
33
33
  import './basic/object/reverseObj.js';
34
34
  import './basic/object/setSort.js';
35
35
  import './basic/object/unmergeObject.js';
36
- import './index-CVrzXZU0.js';
36
+ import './index-CmiMKPSL.js';
37
37
  import './basic/string/appearNum.js';
38
38
  import './basic/string/appearNumSeat.js';
39
39
  import './basic/string/deComment.js';
@@ -48,6 +48,7 @@ import './basic/string/startsNum.js';
48
48
  import './basic/string/toFunction.js';
49
49
  import './basic/string/toJson.js';
50
50
  import './basic/string/toJsons.js';
51
+ import './basic/string/toStringParse.js';
51
52
  import './css/fetchUnitValue.js';
52
53
  import './css/getAttrObj.js';
53
54
  import './css/getCss.js';
package/dist/index.js CHANGED
@@ -16,15 +16,15 @@ import "./chunk-SE7A43WC.js";
16
16
  import "./chunk-GHJWTV6H.js";
17
17
  import "./chunk-UOADEBDH.js";
18
18
  import "./chunk-YWL2IWBT.js";
19
+ import {
20
+ node_exports
21
+ } from "./chunk-UZ3LZBJ5.js";
22
+ import "./chunk-HWR2FRME.js";
19
23
  import {
20
24
  tree_exports
21
25
  } from "./chunk-OVHYLUAS.js";
22
26
  import "./chunk-GVVJIN46.js";
23
27
  import "./chunk-XQOH3NGZ.js";
24
- import {
25
- node_exports
26
- } from "./chunk-UZ3LZBJ5.js";
27
- import "./chunk-HWR2FRME.js";
28
28
  import "./chunk-AWC672JW.js";
29
29
  import {
30
30
  load_exports
@@ -80,10 +80,11 @@ import {
80
80
  import "./chunk-6ZPCYCOL.js";
81
81
  import {
82
82
  basic_exports
83
- } from "./chunk-W2AZSVCH.js";
84
- import "./chunk-YE2JQIXS.js";
83
+ } from "./chunk-FROL42SM.js";
84
+ import "./chunk-SOHG7BA5.js";
85
85
  import "./chunk-U3PZBQ6G.js";
86
86
  import "./chunk-5HC662VK.js";
87
+ import "./chunk-MGK5PCGH.js";
87
88
  import "./chunk-DILPRD5C.js";
88
89
  import "./chunk-7DTHADVK.js";
89
90
  import "./chunk-VKE5JARB.js";
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.27",
5
+ "version": "0.0.28",
6
6
  "description ": "个人工具库",
7
7
  "author": "fangzhongya ",
8
8
  "license": "MIT",
@@ -226,6 +226,11 @@
226
226
  "require": "./dist/basic/string/toJsons.cjs",
227
227
  "import": "./dist/basic/string/toJsons.js"
228
228
  },
229
+ "./basic/string/toStringParse": {
230
+ "types": "./dist/basic/string/toStringParse.d.ts",
231
+ "require": "./dist/basic/string/toStringParse.cjs",
232
+ "import": "./dist/basic/string/toStringParse.js"
233
+ },
229
234
  "./css": {
230
235
  "types": "./dist/css/index.d.ts",
231
236
  "require": "./dist/css/index.cjs",