@fangzhongya/utils 0.0.59 → 0.0.61

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.
Files changed (61) hide show
  1. package/dist/basic/index.cjs +10 -9
  2. package/dist/basic/index.d.cts +2 -1
  3. package/dist/basic/index.d.ts +2 -1
  4. package/dist/basic/index.js +9 -8
  5. package/dist/basic/object/index.cjs +3 -3
  6. package/dist/basic/object/index.js +2 -2
  7. package/dist/basic/object/objValue.cjs +2 -2
  8. package/dist/basic/object/objValue.js +1 -1
  9. package/dist/basic/string/index.cjs +15 -7
  10. package/dist/basic/string/index.d.cts +2 -1
  11. package/dist/basic/string/index.d.ts +2 -1
  12. package/dist/basic/string/index.js +14 -6
  13. package/dist/basic/string/toFunction.cjs +4 -2
  14. package/dist/basic/string/toFunction.d.cts +10 -3
  15. package/dist/basic/string/toFunction.d.ts +10 -3
  16. package/dist/basic/string/toFunction.js +3 -1
  17. package/dist/basic/string/toFunctionParam.cjs +10 -0
  18. package/dist/basic/string/toFunctionParam.d.cts +17 -0
  19. package/dist/basic/string/toFunctionParam.d.ts +17 -0
  20. package/dist/basic/string/toFunctionParam.js +10 -0
  21. package/dist/basic/string/toJson.cjs +3 -3
  22. package/dist/basic/string/toJson.js +2 -2
  23. package/dist/basic/string/toJsons.cjs +4 -4
  24. package/dist/basic/string/toJsons.js +3 -3
  25. package/dist/basic/string/toStringParse.cjs +3 -3
  26. package/dist/basic/string/toStringParse.js +2 -2
  27. package/dist/{chunk-MGK5PCGH.js → chunk-5SCROVEG.js} +1 -1
  28. package/dist/{chunk-2HC7GFXZ.js → chunk-66EQ5D5L.js} +2 -2
  29. package/dist/chunk-6LN4VV4U.cjs +132 -0
  30. package/dist/{chunk-5BAXJJ5P.js → chunk-7M7ORCKS.js} +1 -1
  31. package/dist/{chunk-E4WBX6J5.cjs → chunk-A5UJF6LP.cjs} +1 -0
  32. package/dist/{chunk-U3PZBQ6G.js → chunk-AMVTUA4M.js} +1 -1
  33. package/dist/{chunk-XG44HG5N.cjs → chunk-AYJPZCJF.cjs} +2 -2
  34. package/dist/chunk-DWDFQC7A.js +132 -0
  35. package/dist/{chunk-JHV27P2Q.cjs → chunk-FQJK53WC.cjs} +2 -2
  36. package/dist/{chunk-5HC662VK.js → chunk-IWUJSVXJ.js} +2 -2
  37. package/dist/{chunk-AF2MAOVK.cjs → chunk-KZCLX66D.cjs} +3 -3
  38. package/dist/{chunk-LFF4CLWU.cjs → chunk-M7ZKHA6C.cjs} +4 -4
  39. package/dist/{chunk-ETMYYVQJ.cjs → chunk-O5RJK4XR.cjs} +4 -4
  40. package/dist/{chunk-5GHAMBPJ.cjs → chunk-OGYRG5XZ.cjs} +21 -13
  41. package/dist/{chunk-7O4MJOHM.js → chunk-OQMYUG4U.js} +35 -34
  42. package/dist/{chunk-RDTSG3JZ.js → chunk-QCGLFO5B.js} +12 -4
  43. package/dist/{chunk-754Z5VW6.js → chunk-SHNH5OEU.js} +1 -0
  44. package/dist/{chunk-QXK4IUBI.cjs → chunk-TZSUAKSW.cjs} +35 -34
  45. package/dist/css/index.cjs +13 -13
  46. package/dist/css/index.js +16 -16
  47. package/dist/date/index.cjs +4 -4
  48. package/dist/date/index.js +4 -4
  49. package/dist/{index-DLnJJBhb.d.cts → index-BMhmeVcw.d.cts} +1 -1
  50. package/dist/{index-CxW0zCsG.d.cts → index-BmGaGt2M.d.cts} +7 -2
  51. package/dist/{index-CnVIRWwZ.d.ts → index-CGsG3tMc.d.ts} +1 -1
  52. package/dist/{index-zLctRwm9.d.ts → index-CRh3wZkY.d.ts} +7 -2
  53. package/dist/index.cjs +24 -23
  54. package/dist/index.d.cts +3 -2
  55. package/dist/index.d.ts +3 -2
  56. package/dist/index.js +23 -22
  57. package/package.json +6 -1
  58. package/dist/{chunk-7NEXCOZZ.cjs → chunk-5SOPYS7L.cjs} +3 -3
  59. package/dist/{chunk-JPQN3LUH.js → chunk-H22VVRP6.js} +3 -3
  60. package/dist/{chunk-HWQYLP45.js → chunk-M7CA6X7T.js} +15 -15
  61. package/dist/{chunk-4MF6LYYS.cjs → chunk-XDTLZL44.cjs} +11 -11
@@ -0,0 +1,132 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkTZSUAKSWcjs = require('./chunk-TZSUAKSW.cjs');
5
+
6
+ // packages/basic/string/toFunctionParam.ts
7
+ function buildFunctionString(obj) {
8
+ const { isAsync, isGenerator, param, body } = obj;
9
+ const funcName = obj.name || "";
10
+ const funcSignature = `${isAsync ? "async " : ""}${isGenerator ? "*" : ""}function${funcName ? ` ${funcName}` : ""}`;
11
+ return `${funcSignature}(${param}) { ${body} }`;
12
+ }
13
+ function createSimpleFunction(obj) {
14
+ return new Function(`return ${buildFunctionString(obj)}`)();
15
+ }
16
+ function createFunctionWithClosure(obj, externalParams) {
17
+ const externalKeys = Object.keys(externalParams);
18
+ if (externalKeys.length === 0) {
19
+ return createSimpleFunction(obj);
20
+ }
21
+ try {
22
+ const factory = new Function(
23
+ ...externalKeys,
24
+ `return ${buildFunctionString(obj)};`
25
+ );
26
+ return factory(...externalKeys.map((k) => externalParams[k]));
27
+ } catch (error) {
28
+ const { param, body } = obj;
29
+ const funcParams = param ? _chunkTZSUAKSWcjs.extractParams.call(void 0, param) : [];
30
+ const allParams = [...funcParams, ...externalKeys];
31
+ const closure = new Function(...allParams, body);
32
+ return function(...args) {
33
+ return closure(
34
+ ...args,
35
+ ...externalKeys.map((k) => externalParams[k])
36
+ );
37
+ };
38
+ }
39
+ }
40
+ function createFunctionWithoutClosure(obj, externalParams) {
41
+ const funcParams = obj.param ? _chunkTZSUAKSWcjs.extractParams.call(void 0, obj.param) : [];
42
+ const externalKeys = Object.keys(externalParams);
43
+ const baseFunc = createSimpleFunction(obj);
44
+ return function(...args) {
45
+ const context = {};
46
+ externalKeys.forEach((k) => {
47
+ context[k] = externalParams[k];
48
+ });
49
+ funcParams.forEach((paramName, index) => {
50
+ const cleanParam = paramName.split("=")[0].trim();
51
+ context[cleanParam] = args[index];
52
+ });
53
+ return baseFunc.call(context, ...args);
54
+ };
55
+ }
56
+ function toFunctionParam(str, key, externalParams) {
57
+ try {
58
+ const obj = _chunkTZSUAKSWcjs.getFunctionFormat.call(void 0, str);
59
+ if (!_optionalChain([obj, 'optionalAccess', _ => _.body])) return void 0;
60
+ if (key && !obj.name) {
61
+ obj.name = key;
62
+ }
63
+ if (obj.param) {
64
+ const paramCount = _chunkTZSUAKSWcjs.extractParams.call(void 0, obj.param).length;
65
+ if (paramCount > 1e3) {
66
+ console.warn("Too many parameters, limiting to 1000");
67
+ return void 0;
68
+ }
69
+ }
70
+ if (externalParams && Object.keys(externalParams).length > 0) {
71
+ return createFunctionWithClosure(obj, externalParams);
72
+ } else {
73
+ return createSimpleFunction(obj);
74
+ }
75
+ } catch (error) {
76
+ console.error("Function creation failed:", error);
77
+ return void 0;
78
+ }
79
+ }
80
+ function toFunctionParamOptions(str, key, externalParams, options) {
81
+ try {
82
+ const obj = _chunkTZSUAKSWcjs.getFunctionFormat.call(void 0, str);
83
+ if (!_optionalChain([obj, 'optionalAccess', _2 => _2.body])) return void 0;
84
+ const opts = {
85
+ useClosure: true,
86
+ // 默认使用闭包方式(性能更好)
87
+ strictMode: true,
88
+ context: {},
89
+ paramDefaults: {},
90
+ bindThis: false,
91
+ ...options
92
+ };
93
+ let functionBody = obj.body;
94
+ if (opts.paramDefaults && Object.keys(opts.paramDefaults).length > 0) {
95
+ const defaultsCode = Object.entries(opts.paramDefaults).map(
96
+ ([name, value]) => `if (${name} === undefined) ${name} = ${JSON.stringify(
97
+ value
98
+ )};`
99
+ ).join(" ");
100
+ functionBody = defaultsCode + " " + functionBody;
101
+ }
102
+ if (opts.strictMode) {
103
+ functionBody = `'use strict'; ${functionBody}`;
104
+ }
105
+ const funcObj = { ...obj, body: functionBody };
106
+ if (key && !funcObj.name) {
107
+ funcObj.name = key;
108
+ }
109
+ let result;
110
+ if (externalParams && Object.keys(externalParams).length > 0) {
111
+ if (opts.useClosure) {
112
+ result = createFunctionWithClosure(funcObj, externalParams);
113
+ } else {
114
+ result = createFunctionWithoutClosure(funcObj, externalParams);
115
+ }
116
+ } else {
117
+ result = createSimpleFunction(funcObj);
118
+ }
119
+ if (opts.bindThis && opts.context && Object.keys(opts.context).length > 0) {
120
+ return result.bind(opts.context);
121
+ }
122
+ return result;
123
+ } catch (error) {
124
+ console.error("Enhanced function creation failed:", error);
125
+ return void 0;
126
+ }
127
+ }
128
+
129
+
130
+
131
+
132
+ exports.toFunctionParam = toFunctionParam; exports.toFunctionParamOptions = toFunctionParamOptions;
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  getObjValue,
15
15
  setObjValue
16
- } from "./chunk-754Z5VW6.js";
16
+ } from "./chunk-SHNH5OEU.js";
17
17
  import {
18
18
  reverseObj
19
19
  } from "./chunk-B3IGSYZT.js";
@@ -10,6 +10,7 @@ function getObjValue(key, locale) {
10
10
  return result;
11
11
  }
12
12
  function setObjValue(locale, key, value) {
13
+ if (typeof locale !== "object" || locale === null) return;
13
14
  if (!key) return Object.assign(locale, value);
14
15
  const path = key.split(".");
15
16
  const lastKey = path.pop();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toFunction
3
- } from "./chunk-7O4MJOHM.js";
3
+ } from "./chunk-OQMYUG4U.js";
4
4
 
5
5
  // packages/basic/string/toJson.ts
6
6
  function toJSONStringify(obj, space) {
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
3
+ var _chunkTZSUAKSWcjs = require('./chunk-TZSUAKSW.cjs');
4
4
 
5
5
  // packages/basic/string/toStringParse.ts
6
6
  var arrayBufferUtils = {
@@ -71,7 +71,7 @@ function toStringParse(str, type, split = ",") {
71
71
  case "boolean":
72
72
  return Boolean(str);
73
73
  case "function":
74
- return _chunkQXK4IUBIcjs.toFunction.call(void 0, str) || function() {
74
+ return _chunkTZSUAKSWcjs.toFunction.call(void 0, str) || function() {
75
75
  };
76
76
  case "undefined":
77
77
  return void 0;
@@ -0,0 +1,132 @@
1
+ import {
2
+ extractParams,
3
+ getFunctionFormat
4
+ } from "./chunk-OQMYUG4U.js";
5
+
6
+ // packages/basic/string/toFunctionParam.ts
7
+ function buildFunctionString(obj) {
8
+ const { isAsync, isGenerator, param, body } = obj;
9
+ const funcName = obj.name || "";
10
+ const funcSignature = `${isAsync ? "async " : ""}${isGenerator ? "*" : ""}function${funcName ? ` ${funcName}` : ""}`;
11
+ return `${funcSignature}(${param}) { ${body} }`;
12
+ }
13
+ function createSimpleFunction(obj) {
14
+ return new Function(`return ${buildFunctionString(obj)}`)();
15
+ }
16
+ function createFunctionWithClosure(obj, externalParams) {
17
+ const externalKeys = Object.keys(externalParams);
18
+ if (externalKeys.length === 0) {
19
+ return createSimpleFunction(obj);
20
+ }
21
+ try {
22
+ const factory = new Function(
23
+ ...externalKeys,
24
+ `return ${buildFunctionString(obj)};`
25
+ );
26
+ return factory(...externalKeys.map((k) => externalParams[k]));
27
+ } catch (error) {
28
+ const { param, body } = obj;
29
+ const funcParams = param ? extractParams(param) : [];
30
+ const allParams = [...funcParams, ...externalKeys];
31
+ const closure = new Function(...allParams, body);
32
+ return function(...args) {
33
+ return closure(
34
+ ...args,
35
+ ...externalKeys.map((k) => externalParams[k])
36
+ );
37
+ };
38
+ }
39
+ }
40
+ function createFunctionWithoutClosure(obj, externalParams) {
41
+ const funcParams = obj.param ? extractParams(obj.param) : [];
42
+ const externalKeys = Object.keys(externalParams);
43
+ const baseFunc = createSimpleFunction(obj);
44
+ return function(...args) {
45
+ const context = {};
46
+ externalKeys.forEach((k) => {
47
+ context[k] = externalParams[k];
48
+ });
49
+ funcParams.forEach((paramName, index) => {
50
+ const cleanParam = paramName.split("=")[0].trim();
51
+ context[cleanParam] = args[index];
52
+ });
53
+ return baseFunc.call(context, ...args);
54
+ };
55
+ }
56
+ function toFunctionParam(str, key, externalParams) {
57
+ try {
58
+ const obj = getFunctionFormat(str);
59
+ if (!obj?.body) return void 0;
60
+ if (key && !obj.name) {
61
+ obj.name = key;
62
+ }
63
+ if (obj.param) {
64
+ const paramCount = extractParams(obj.param).length;
65
+ if (paramCount > 1e3) {
66
+ console.warn("Too many parameters, limiting to 1000");
67
+ return void 0;
68
+ }
69
+ }
70
+ if (externalParams && Object.keys(externalParams).length > 0) {
71
+ return createFunctionWithClosure(obj, externalParams);
72
+ } else {
73
+ return createSimpleFunction(obj);
74
+ }
75
+ } catch (error) {
76
+ console.error("Function creation failed:", error);
77
+ return void 0;
78
+ }
79
+ }
80
+ function toFunctionParamOptions(str, key, externalParams, options) {
81
+ try {
82
+ const obj = getFunctionFormat(str);
83
+ if (!obj?.body) return void 0;
84
+ const opts = {
85
+ useClosure: true,
86
+ // 默认使用闭包方式(性能更好)
87
+ strictMode: true,
88
+ context: {},
89
+ paramDefaults: {},
90
+ bindThis: false,
91
+ ...options
92
+ };
93
+ let functionBody = obj.body;
94
+ if (opts.paramDefaults && Object.keys(opts.paramDefaults).length > 0) {
95
+ const defaultsCode = Object.entries(opts.paramDefaults).map(
96
+ ([name, value]) => `if (${name} === undefined) ${name} = ${JSON.stringify(
97
+ value
98
+ )};`
99
+ ).join(" ");
100
+ functionBody = defaultsCode + " " + functionBody;
101
+ }
102
+ if (opts.strictMode) {
103
+ functionBody = `'use strict'; ${functionBody}`;
104
+ }
105
+ const funcObj = { ...obj, body: functionBody };
106
+ if (key && !funcObj.name) {
107
+ funcObj.name = key;
108
+ }
109
+ let result;
110
+ if (externalParams && Object.keys(externalParams).length > 0) {
111
+ if (opts.useClosure) {
112
+ result = createFunctionWithClosure(funcObj, externalParams);
113
+ } else {
114
+ result = createFunctionWithoutClosure(funcObj, externalParams);
115
+ }
116
+ } else {
117
+ result = createSimpleFunction(funcObj);
118
+ }
119
+ if (opts.bindThis && opts.context && Object.keys(opts.context).length > 0) {
120
+ return result.bind(opts.context);
121
+ }
122
+ return result;
123
+ } catch (error) {
124
+ console.error("Enhanced function creation failed:", error);
125
+ return void 0;
126
+ }
127
+ }
128
+
129
+ export {
130
+ toFunctionParam,
131
+ toFunctionParamOptions
132
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
3
+ var _chunkTZSUAKSWcjs = require('./chunk-TZSUAKSW.cjs');
4
4
 
5
5
  // packages/basic/string/toJson.ts
6
6
  function toJSONStringify(obj, space) {
@@ -33,7 +33,7 @@ function toJSONParse(str, reviver) {
33
33
  case "symbol":
34
34
  return Symbol(value.value);
35
35
  case "function":
36
- return _chunkQXK4IUBIcjs.toFunction.call(void 0, value.value) || value;
36
+ return _chunkTZSUAKSWcjs.toFunction.call(void 0, value.value) || value;
37
37
  case "undefined":
38
38
  return void 0;
39
39
  case "Date":
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toFunction
3
- } from "./chunk-7O4MJOHM.js";
3
+ } from "./chunk-OQMYUG4U.js";
4
4
  import {
5
5
  getObjValue
6
- } from "./chunk-754Z5VW6.js";
6
+ } from "./chunk-SHNH5OEU.js";
7
7
 
8
8
  // packages/basic/string/toJsons.ts
9
9
  var TYPE_MARKERS = {
@@ -13,7 +13,7 @@ var _chunkNRJPCN4Jcjs = require('./chunk-NRJPCN4J.cjs');
13
13
 
14
14
 
15
15
 
16
- var _chunkE4WBX6J5cjs = require('./chunk-E4WBX6J5.cjs');
16
+ var _chunkA5UJF6LPcjs = require('./chunk-A5UJF6LP.cjs');
17
17
 
18
18
 
19
19
  var _chunkSLXKYTEUcjs = require('./chunk-SLXKYTEU.cjs');
@@ -59,7 +59,7 @@ _chunk75ZPJI57cjs.__export.call(void 0, object_exports, {
59
59
  deepCopys: () => _chunkSJ74DU4Bcjs.deepCopys,
60
60
  fastDeepCopy: () => _chunkSJ74DU4Bcjs.fastDeepCopy,
61
61
  filterObject: () => _chunkD3SX7OUVcjs.filterObject,
62
- getObjValue: () => _chunkE4WBX6J5cjs.getObjValue,
62
+ getObjValue: () => _chunkA5UJF6LPcjs.getObjValue,
63
63
  getSort: () => _chunk7AIT4XSDcjs.getSort,
64
64
  hasOwn: () => _chunkGOUC2DFAcjs.hasOwn,
65
65
  isEqual: () => _chunkWWAPPA4Ecjs.isEqual,
@@ -70,7 +70,7 @@ _chunk75ZPJI57cjs.__export.call(void 0, object_exports, {
70
70
  mergeObject: () => _chunkNRJPCN4Jcjs.mergeObject,
71
71
  reverseObj: () => _chunkSLXKYTEUcjs.reverseObj,
72
72
  safeDeepCopy: () => _chunkSJ74DU4Bcjs.safeDeepCopy,
73
- setObjValue: () => _chunkE4WBX6J5cjs.setObjValue,
73
+ setObjValue: () => _chunkA5UJF6LPcjs.setObjValue,
74
74
  setSort: () => _chunkIIKQHLKTcjs.setSort,
75
75
  simpleDeepCopy: () => _chunkSJ74DU4Bcjs.simpleDeepCopy,
76
76
  structuredCloneCopy: () => _chunkSJ74DU4Bcjs.structuredCloneCopy,
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5GHAMBPJcjs = require('./chunk-5GHAMBPJ.cjs');
3
+ var _chunkOGYRG5XZcjs = require('./chunk-OGYRG5XZ.cjs');
4
4
 
5
5
 
6
- var _chunkAF2MAOVKcjs = require('./chunk-AF2MAOVK.cjs');
6
+ var _chunkKZCLX66Dcjs = require('./chunk-KZCLX66D.cjs');
7
7
 
8
8
 
9
9
  var _chunk65O7KWP4cjs = require('./chunk-65O7KWP4.cjs');
@@ -15,8 +15,8 @@ var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
15
15
  var basic_exports = {};
16
16
  _chunk75ZPJI57cjs.__export.call(void 0, basic_exports, {
17
17
  array: () => _chunk65O7KWP4cjs.array_exports,
18
- object: () => _chunkAF2MAOVKcjs.object_exports,
19
- string: () => _chunk5GHAMBPJcjs.string_exports
18
+ object: () => _chunkKZCLX66Dcjs.object_exports,
19
+ string: () => _chunkOGYRG5XZcjs.string_exports
20
20
  });
21
21
 
22
22
 
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
3
+ var _chunkTZSUAKSWcjs = require('./chunk-TZSUAKSW.cjs');
4
4
 
5
5
 
6
- var _chunkE4WBX6J5cjs = require('./chunk-E4WBX6J5.cjs');
6
+ var _chunkA5UJF6LPcjs = require('./chunk-A5UJF6LP.cjs');
7
7
 
8
8
  // packages/basic/string/toJsons.ts
9
9
  var TYPE_MARKERS = {
@@ -260,7 +260,7 @@ function toJSONSParse(str, context) {
260
260
  case TYPE_MARKERS.SYMBOL:
261
261
  return markerValue.k ? Symbol.for(markerValue.k) : Symbol(markerValue.d);
262
262
  case TYPE_MARKERS.FUNCTION:
263
- return _chunkQXK4IUBIcjs.toFunction.call(void 0, markerValue, key) || function() {
263
+ return _chunkTZSUAKSWcjs.toFunction.call(void 0, markerValue, key) || function() {
264
264
  };
265
265
  case TYPE_MARKERS.NAN:
266
266
  return NaN;
@@ -269,7 +269,7 @@ function toJSONSParse(str, context) {
269
269
  case TYPE_MARKERS.NEGATIVE_INFINITY:
270
270
  return -Infinity;
271
271
  case TYPE_MARKERS.FUNCTION_REF:
272
- return context ? _chunkE4WBX6J5cjs.getObjValue.call(void 0, markerValue, context) : void 0;
272
+ return context ? _chunkA5UJF6LPcjs.getObjValue.call(void 0, markerValue, context) : void 0;
273
273
  case TYPE_MARKERS.CODE_BLOCK:
274
274
  return getCodeBlock(markerValue, key);
275
275
  }
@@ -1,16 +1,20 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkJHV27P2Qcjs = require('./chunk-JHV27P2Q.cjs');
4
+ var _chunk6LN4VV4Ucjs = require('./chunk-6LN4VV4U.cjs');
5
5
 
6
6
 
7
7
 
8
+ var _chunkFQJK53WCcjs = require('./chunk-FQJK53WC.cjs');
8
9
 
9
10
 
10
- var _chunkETMYYVQJcjs = require('./chunk-ETMYYVQJ.cjs');
11
11
 
12
12
 
13
- var _chunkXG44HG5Ncjs = require('./chunk-XG44HG5N.cjs');
13
+
14
+ var _chunkO5RJK4XRcjs = require('./chunk-O5RJK4XR.cjs');
15
+
16
+
17
+ var _chunkAYJPZCJFcjs = require('./chunk-AYJPZCJF.cjs');
14
18
 
15
19
 
16
20
 
@@ -24,7 +28,8 @@ var _chunkL7FSHU27cjs = require('./chunk-L7FSHU27.cjs');
24
28
 
25
29
 
26
30
 
27
- var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
31
+
32
+ var _chunkTZSUAKSWcjs = require('./chunk-TZSUAKSW.cjs');
28
33
 
29
34
 
30
35
  var _chunkXWCRGY54cjs = require('./chunk-XWCRGY54.cjs');
@@ -63,26 +68,29 @@ _chunk75ZPJI57cjs.__export.call(void 0, string_exports, {
63
68
  appearNum: () => _chunkOJBZ7UUCcjs.appearNum,
64
69
  appearNumSeat: () => _chunkJR6ZN6QDcjs.appearNumSeat,
65
70
  deComment: () => _chunkXWCRGY54cjs.deComment,
71
+ extractParams: () => _chunkTZSUAKSWcjs.extractParams,
66
72
  firstLower: () => _chunkUEVMS6QDcjs.firstLower,
67
73
  firstUpper: () => _chunkOQL4GIEJcjs.firstUpper,
68
74
  getContent: () => _chunk4PUYFFPOcjs.getContent,
69
75
  getContents: () => _chunk4PUYFFPOcjs.getContents,
70
- getFunctionFormat: () => _chunkQXK4IUBIcjs.getFunctionFormat,
76
+ getFunctionFormat: () => _chunkTZSUAKSWcjs.getFunctionFormat,
71
77
  getImports: () => _chunkHWHYHL6Jcjs.getImports,
72
78
  getImportss: () => _chunkHWHYHL6Jcjs.getImportss,
73
79
  getStartSame: () => _chunkJ7S3KBHLcjs.getStartSame,
74
80
  getStartSames: () => _chunkPW7RP73Jcjs.getStartSames,
75
81
  getStrNunPosit: () => _chunk2H3KVSFAcjs.getStrNunPosit,
76
- serializeCodeBlock: () => _chunkETMYYVQJcjs.serializeCodeBlock,
77
- serializeFunctionRef: () => _chunkETMYYVQJcjs.serializeFunctionRef,
82
+ serializeCodeBlock: () => _chunkO5RJK4XRcjs.serializeCodeBlock,
83
+ serializeFunctionRef: () => _chunkO5RJK4XRcjs.serializeFunctionRef,
78
84
  splitUpper: () => _chunkL7FSHU27cjs.splitUpper,
79
85
  startsNum: () => _chunkILJLXJ5Ocjs.startsNum,
80
- toFunction: () => _chunkQXK4IUBIcjs.toFunction,
81
- toJSONParse: () => _chunkJHV27P2Qcjs.toJSONParse,
82
- toJSONSParse: () => _chunkETMYYVQJcjs.toJSONSParse,
83
- toJSONSStringify: () => _chunkETMYYVQJcjs.toJSONSStringify,
84
- toJSONStringify: () => _chunkJHV27P2Qcjs.toJSONStringify,
85
- toStringParse: () => _chunkXG44HG5Ncjs.toStringParse
86
+ toFunction: () => _chunkTZSUAKSWcjs.toFunction,
87
+ toFunctionParam: () => _chunk6LN4VV4Ucjs.toFunctionParam,
88
+ toFunctionParamOptions: () => _chunk6LN4VV4Ucjs.toFunctionParamOptions,
89
+ toJSONParse: () => _chunkFQJK53WCcjs.toJSONParse,
90
+ toJSONSParse: () => _chunkO5RJK4XRcjs.toJSONSParse,
91
+ toJSONSStringify: () => _chunkO5RJK4XRcjs.toJSONSStringify,
92
+ toJSONStringify: () => _chunkFQJK53WCcjs.toJSONStringify,
93
+ toStringParse: () => _chunkAYJPZCJFcjs.toStringParse
86
94
  });
87
95
 
88
96
 
@@ -37,38 +37,6 @@ function extractParams(paramStr) {
37
37
  if (current.trim()) result.push(current.trim());
38
38
  return result;
39
39
  }
40
- function toFunction(str, key) {
41
- try {
42
- const obj = getFunctionFormat(str);
43
- if (!obj?.body) return void 0;
44
- const params = obj.param ? extractParams(obj.param) : [];
45
- if (params.length > 1e3) {
46
- throw new Error("Too many parameters (max: 1000)");
47
- }
48
- if (obj.isAsync) {
49
- try {
50
- const fullFunction = `async function${obj.isGenerator ? "*" : ""} ${obj.name ?? key ?? ""} (${obj.param}) { ${obj.body} }`;
51
- return new Function(`return ${fullFunction}`)();
52
- } catch (error) {
53
- const fullFunction = `async function${obj.isGenerator ? "*" : ""} (${obj.param}) { ${obj.body} }`;
54
- return new Function(`return ${fullFunction}`)();
55
- }
56
- } else {
57
- try {
58
- const fullFunction = `function${obj.isGenerator ? "*" : ""} ${obj.name ?? key ?? ""}(${obj.param}) { ${obj.body} }`;
59
- return new Function(`return (${fullFunction})`)();
60
- } catch (error) {
61
- return new Function(...params, obj.body);
62
- }
63
- }
64
- } catch (error) {
65
- console.error("Function creation failed:", {
66
- input: str.slice(0, 100),
67
- error
68
- });
69
- return void 0;
70
- }
71
- }
72
40
  var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
73
41
  function getFunctionFormat(v) {
74
42
  if (!v) return;
@@ -135,8 +103,41 @@ function getFunctionFormat(v) {
135
103
  body: body.trim()
136
104
  };
137
105
  }
106
+ function toFunction(str, key) {
107
+ try {
108
+ const obj = getFunctionFormat(str);
109
+ if (!obj?.body) return void 0;
110
+ const params = obj.param ? extractParams(obj.param) : [];
111
+ if (params.length > 1e3) {
112
+ throw new Error("Too many parameters (max: 1000)");
113
+ }
114
+ if (obj.isAsync) {
115
+ try {
116
+ const fullFunction = `async function${obj.isGenerator ? "*" : ""} ${obj.name ?? key ?? ""} (${obj.param}) { ${obj.body} }`;
117
+ return new Function(`return ${fullFunction}`)();
118
+ } catch (error) {
119
+ const fullFunction = `async function${obj.isGenerator ? "*" : ""} (${obj.param}) { ${obj.body} }`;
120
+ return new Function(`return ${fullFunction}`)();
121
+ }
122
+ } else {
123
+ try {
124
+ const fullFunction = `function${obj.isGenerator ? "*" : ""} ${obj.name ?? key ?? ""}(${obj.param}) { ${obj.body} }`;
125
+ return new Function(`return (${fullFunction})`)();
126
+ } catch (error) {
127
+ return new Function(...params, obj.body);
128
+ }
129
+ }
130
+ } catch (error) {
131
+ console.error("Function creation failed:", {
132
+ input: str.slice(0, 100),
133
+ error
134
+ });
135
+ return void 0;
136
+ }
137
+ }
138
138
 
139
139
  export {
140
- toFunction,
141
- getFunctionFormat
140
+ extractParams,
141
+ getFunctionFormat,
142
+ toFunction
142
143
  };
@@ -1,16 +1,20 @@
1
+ import {
2
+ toFunctionParam,
3
+ toFunctionParamOptions
4
+ } from "./chunk-DWDFQC7A.js";
1
5
  import {
2
6
  toJSONParse,
3
7
  toJSONStringify
4
- } from "./chunk-U3PZBQ6G.js";
8
+ } from "./chunk-AMVTUA4M.js";
5
9
  import {
6
10
  serializeCodeBlock,
7
11
  serializeFunctionRef,
8
12
  toJSONSParse,
9
13
  toJSONSStringify
10
- } from "./chunk-5HC662VK.js";
14
+ } from "./chunk-IWUJSVXJ.js";
11
15
  import {
12
16
  toStringParse
13
- } from "./chunk-MGK5PCGH.js";
17
+ } from "./chunk-5SCROVEG.js";
14
18
  import {
15
19
  getImports,
16
20
  getImportss
@@ -22,9 +26,10 @@ import {
22
26
  splitUpper
23
27
  } from "./chunk-VKE5JARB.js";
24
28
  import {
29
+ extractParams,
25
30
  getFunctionFormat,
26
31
  toFunction
27
- } from "./chunk-7O4MJOHM.js";
32
+ } from "./chunk-OQMYUG4U.js";
28
33
  import {
29
34
  deComment
30
35
  } from "./chunk-FS4JPT23.js";
@@ -63,6 +68,7 @@ __export(string_exports, {
63
68
  appearNum: () => appearNum,
64
69
  appearNumSeat: () => appearNumSeat,
65
70
  deComment: () => deComment,
71
+ extractParams: () => extractParams,
66
72
  firstLower: () => firstLower,
67
73
  firstUpper: () => firstUpper,
68
74
  getContent: () => getContent,
@@ -78,6 +84,8 @@ __export(string_exports, {
78
84
  splitUpper: () => splitUpper,
79
85
  startsNum: () => startsNum,
80
86
  toFunction: () => toFunction,
87
+ toFunctionParam: () => toFunctionParam,
88
+ toFunctionParamOptions: () => toFunctionParamOptions,
81
89
  toJSONParse: () => toJSONParse,
82
90
  toJSONSParse: () => toJSONSParse,
83
91
  toJSONSStringify: () => toJSONSStringify,
@@ -10,6 +10,7 @@ function getObjValue(key, locale) {
10
10
  return result;
11
11
  }
12
12
  function setObjValue(locale, key, value) {
13
+ if (typeof locale !== "object" || locale === null) return;
13
14
  if (!key) return Object.assign(locale, value);
14
15
  const path = key.split(".");
15
16
  const lastKey = path.pop();