funda-ui 4.7.604 → 4.7.608
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.
- package/Chatbox/index.js +123 -69
- package/LiveSearch/index.js +117 -67
- package/MultipleCheckboxes/index.js +117 -67
- package/MultipleSelect/index.js +117 -67
- package/NativeSelect/index.js +117 -67
- package/Radio/index.js +117 -67
- package/Select/index.js +117 -67
- package/Utils/anim.js +116 -62
- package/Utils/initDefaultOptions.js +116 -62
- package/Utils/validate.d.ts +1 -7
- package/Utils/validate.js +115 -62
- package/lib/cjs/Chatbox/index.js +123 -69
- package/lib/cjs/LiveSearch/index.js +117 -67
- package/lib/cjs/MultipleCheckboxes/index.js +117 -67
- package/lib/cjs/MultipleSelect/index.js +117 -67
- package/lib/cjs/NativeSelect/index.js +117 -67
- package/lib/cjs/Radio/index.js +117 -67
- package/lib/cjs/Select/index.js +117 -67
- package/lib/cjs/Utils/anim.js +116 -62
- package/lib/cjs/Utils/initDefaultOptions.js +116 -62
- package/lib/cjs/Utils/validate.d.ts +1 -7
- package/lib/cjs/Utils/validate.js +115 -62
- package/lib/esm/Chatbox/index.tsx +8 -2
- package/lib/esm/Utils/libs/validate.ts +167 -194
- package/package.json +1 -1
package/lib/cjs/Radio/index.js
CHANGED
|
@@ -638,10 +638,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
638
638
|
__nested_webpack_require_993__.r(__webpack_exports__);
|
|
639
639
|
/* harmony export */
|
|
640
640
|
__nested_webpack_require_993__.d(__webpack_exports__, {
|
|
641
|
-
/* harmony export */"fixAndParseJSON": function fixAndParseJSON() {
|
|
642
|
-
return (/* binding */_fixAndParseJSON
|
|
643
|
-
);
|
|
644
|
-
},
|
|
645
641
|
/* harmony export */"isEmail": function isEmail() {
|
|
646
642
|
return (/* binding */_isEmail
|
|
647
643
|
);
|
|
@@ -687,63 +683,82 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
687
683
|
}
|
|
688
684
|
/**
|
|
689
685
|
* Fix And Parse JSON (Support for handling complex escape JSON strings)
|
|
686
|
+
* @desc recursively fix top-level key/value (recursively handles when encountering top-level values that are objects/arrays)
|
|
690
687
|
* @private
|
|
691
688
|
*/
|
|
692
689
|
/*
|
|
693
|
-
-
|
|
694
|
-
-
|
|
695
|
-
- Then process the outermost object or array key
|
|
696
|
-
- If a top-level value is an unquoted object or array (e.g
|
|
697
|
-
|
|
698
|
-
- For values wrapped in quotes ('...' or "..."), extract the inner text and
|
|
699
|
-
re-encode it using JSON.stringify (ensures internal single/double quotes
|
|
700
|
-
are not corrupted);
|
|
690
|
+
- Still prioritize JSON.parse first;
|
|
691
|
+
- After parse fails, do unescaping (\\" → ");
|
|
692
|
+
- Then process the outermost layer (object or array) key by key, value by value;
|
|
693
|
+
- If a top-level value is an unquoted object or array (e.g., messages: [ {...} ]), recursively treat that value as a new outermost layer for fixing;
|
|
694
|
+
- For strings wrapped in quotes ('...' or "..."), only extract the outer layer and re-encode with JSON.stringify (ensuring internal single/double quotes won't be mistakenly changed);
|
|
701
695
|
- Set MAX_DEPTH to prevent infinite recursion.
|
|
702
696
|
*/
|
|
703
|
-
// fixAndParseJSON - recursively repairs top-level key/value
|
|
704
|
-
// (when encountering outermost values that are objects/arrays, it recurses)
|
|
705
|
-
|
|
706
697
|
/*
|
|
707
|
-
|
|
698
|
+
@Examples:
|
|
708
699
|
|
|
709
|
-
// ✅ Valid JSON (contains svg and single
|
|
700
|
+
// ✅ Valid JSON (contains svg and single quote content)
|
|
710
701
|
const okJson = `{
|
|
711
|
-
"label":"<svg width='16' height='16'><path fill='currentColor' d='M19 13h-6'/></svg>
|
|
702
|
+
"label":"<svg width='16' height='16'><path fill='currentColor' d='M19 13h-6'/></svg> 新建会话",
|
|
712
703
|
"value":"new",
|
|
713
704
|
"onClick":"method.setVal(''); method.clearData();"
|
|
714
705
|
}`;
|
|
715
706
|
|
|
716
|
-
|
|
707
|
+
const okJson2 = `{
|
|
708
|
+
label:"<svg width='16' height='16'><path fill='currentColor' d='M19 13h-6'/></svg> 新建会话",
|
|
709
|
+
value:"new",
|
|
710
|
+
onClick:"method.setVal(''); method.clearData();"
|
|
711
|
+
}`;
|
|
712
|
+
|
|
713
|
+
// ⚠️ Single quote JSON
|
|
717
714
|
const badJson = "{'model':'{model}','messages':[{'role':'user','content':'{message}'}],'stream': true}";
|
|
718
715
|
|
|
719
|
-
//
|
|
720
|
-
const badJson2 = "{\\\"label\\\":\\\"<svg width='16' height='16' viewBox='0 0 24 24'><path fill='currentColor' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/></svg>
|
|
716
|
+
// ⚠️ Escaped JSON
|
|
717
|
+
const badJson2 = "{\\\"label\\\":\\\"<svg width='16' height='16' viewBox='0 0 24 24'><path fill='currentColor' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/></svg> 新建会话\\\",\\\"value\\\":\\\"new\\\",\\\"onClick\\\":\\\"method.setVal(''); method.clearData();\\\"}";
|
|
718
|
+
|
|
719
|
+
const badJson3 = "{\"label\":\"<svg width='16' height='16' viewBox='0 0 24 24'><path fill='currentColor' d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/></svg> 新建会话\",\"value\":\"new\",\"onClick\":\"method.setVal(''); method.clearData();\"}";
|
|
720
|
+
|
|
721
|
+
const badJson4 = "[{\"label\":\"<svg fill='currentColor' width='12' height='12' viewBox='0 0 24 24'><path d='M20.5 9a3.49 3.49 0 0 0-3.45 3h-1.1a2.49 2.49 0 0 0-4.396-1.052L8.878 9.731l3.143-4.225a2.458 2.458 0 0 0 2.98-.019L17.339 8H16v1h3V6h-1v1.243l-2.336-2.512A2.473 2.473 0 0 0 16 3.5a2.5 2.5 0 0 0-5 0 2.474 2.474 0 0 0 .343 1.243L7.947 9.308 4.955 7.947a2.404 2.404 0 0 0-.161-1.438l3.704-1.385-.44 1.371.942.333L10 4 7.172 3l-.334.943 1.01.357-3.659 1.368a2.498 2.498 0 1 0-.682 4.117l2.085 2.688-2.053 2.76a2.5 2.5 0 1 0 .87 3.864l3.484 1.587-1.055.373.334.943L10 21l-1-2.828-.943.333.435 1.354-3.608-1.645A2.471 2.471 0 0 0 5 17.5a2.5 2.5 0 0 0-.058-.527l3.053-1.405 3.476 4.48a2.498 2.498 0 1 0 4.113.075L18 17.707V19h1v-3h-3v1h1.293l-2.416 2.416a2.466 2.466 0 0 0-2.667-.047l-3.283-4.23 2.554-1.176A2.494 2.494 0 0 0 15.95 13h1.1a3.493 3.493 0 1 0 3.45-4zm-7-7A1.5 1.5 0 1 1 12 3.5 1.502 1.502 0 0 1 13.5 2zm0 18a1.5 1.5 0 1 1-1.5 1.5 1.502 1.502 0 0 1 1.5-1.5zM1 7.5a1.5 1.5 0 1 1 2.457 1.145l-.144.112A1.496 1.496 0 0 1 1 7.5zm3.32 1.703a2.507 2.507 0 0 0 .264-.326l2.752 1.251-1.124 1.512zM2.5 19A1.5 1.5 0 1 1 4 17.5 1.502 1.502 0 0 1 2.5 19zm2.037-2.941a2.518 2.518 0 0 0-.193-.234l1.885-2.532 1.136 1.464zm3.76-1.731L6.849 12.46l1.42-1.908L11.1 11.84a2.29 2.29 0 0 0-.033 1.213zM13.5 14a1.5 1.5 0 1 1 1.5-1.5 1.502 1.502 0 0 1-1.5 1.5zm7 1a2.5 2.5 0 1 1 2.5-2.5 2.502 2.502 0 0 1-2.5 2.5zm1.5-2.5a1.5 1.5 0 1 1-1.5-1.5 1.502 1.502 0 0 1 1.5 1.5z'/><path fill='none' d='M0 0h24v24H0z'/></svg> 深度思考\",\"value\":\"brief\",\"onClick\":\"if(isActive){method.executeCustomMethod('changeModel', true)}else{method.executeCustomMethod('changeModel', false)}\"},{\"label\":\"<svg fill='currentColor' width='12' height='12' viewBox='0 0 24 24'><path d='M19 2H5c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h3.586L12 21.414 15.414 18H19c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zm0 14h-4.414L12 18.586 9.414 16H5V4h14v12z'/></svg> 精简回答\",\"value\":\"brief\",\"onClick\":\"if(isActive){method.setContextData({systemPrompt:'请精简回答,字数控制在150个字左右, 思考过程请简洁简短',mergedText:method.getContextData().mergedText,analyzeMetrics:method.getContextData().analyzeMetrics});}else{method.setContextData({mergedText:method.getContextData().mergedText,analyzeMetrics:method.getContextData().analyzeMetrics});}\"},{\"label\":\"<svg fill='none' width='12' height='12' viewBox='0 0 16 16'><path d='M7 0.0618896V9H15.9381C15.446 12.9463 12.0796 16 8 16C3.58172 16 0 12.4183 0 8C0 3.92038 3.05369 0.553988 7 0.0618896Z' fill='currentColor'/><path d='M9 0.0618897V7H15.9381C15.4869 3.38128 12.6187 0.513137 9 0.0618897Z' fill='currentColor'/></svg> 指标分析\",\"value\":\"lab\",\"onClick\":\"return method.executeCustomMethod('getLibList')\",\"isSelect\":true,\"dynamicOptions\":true}]";
|
|
722
|
+
|
|
721
723
|
|
|
722
|
-
|
|
724
|
+
// ❌ Invalid JSON with missing } or ]
|
|
725
|
+
const errorJson001 = "{'model':'qwen-plus','base_url':'https://dashscope.aliyuncs.com/compatible-mode/v1/','api_key':'sk-0989fb9baab8450682af4d000f5b7cba','message':'{message}','stream':'true','chatId': '{chatId}', 'token': '{token}'";
|
|
723
726
|
|
|
724
|
-
const
|
|
727
|
+
const errorJson002 = "[{'model':'qwen-plus','base_url':'https://dashscope.aliyuncs.com/compatible-mode/v1/','api_key':'sk-0989fb9baab8450682af4d000f5b7cba','message':'{message}','stream':'true','chatId': '{chatId}', 'token': '{token}'}";
|
|
725
728
|
|
|
729
|
+
// ❌ Invalid JSON with missing quotes
|
|
730
|
+
const errorJson003 = "{'model':'qwen-plus','base_url':'https://dashscope.aliyuncs.com/compatible-mode/v1/','api_key':'sk-0989fb9baab8450682af4d000f5b7cba','message':'{message}','stream':'true','chatId': {chatId}', 'token': '{token}'}";
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
console.log('okJson =>', fixAndParseJSON(okJson)); // Can parse normally success = true
|
|
735
|
+
console.log('okJson =>', fixAndParseJSON(okJson2)); // Can parse normally success = true
|
|
736
|
+
console.log('badJson =>', fixAndParseJSON(badJson)); // Can parse after fixing success = true
|
|
737
|
+
console.log('badJson =>', fixAndParseJSON(badJson2)); // Can parse after fixing success = true
|
|
738
|
+
console.log('badJson =>', fixAndParseJSON(badJson3)); // Can parse after fixing success = true
|
|
739
|
+
console.log('badJson =>', fixAndParseJSON(badJson4)); // Can parse after fixing success = true
|
|
740
|
+
console.log('errorJson =>', fixAndParseJSON(errorJson001)); // {success: false, error: 'Invalid JSON format', details: 'Invalid object: mismatched braces'}
|
|
741
|
+
console.log('errorJson =>', fixAndParseJSON(errorJson002)); // {success: false, error: 'Invalid JSON format', details: "Expected property name or '}' in JSON at position 2 (line 1 column 3)"}
|
|
742
|
+
console.log('errorJson =>', fixAndParseJSON(errorJson003)); // {success: false, error: 'Invalid JSON format', details: 'Invalid object: mismatched braces'}
|
|
726
743
|
|
|
727
|
-
console.log('okJson =>', fixAndParseJSON(okJson)); // parses correctly
|
|
728
|
-
console.log('badJson =>', fixAndParseJSON(badJson)); // repaired and parsed
|
|
729
|
-
console.log('badJson2 =>', fixAndParseJSON(badJson2)); // repaired and parsed
|
|
730
|
-
console.log('badJson3 =>', fixAndParseJSON(badJson3)); // repaired and parsed
|
|
731
|
-
console.log('badJson4 =>', fixAndParseJSON(badJson4)); // repaired and parsed
|
|
732
744
|
*/
|
|
733
|
-
|
|
745
|
+
|
|
746
|
+
// Type definitions
|
|
747
|
+
|
|
748
|
+
function fixAndParseJSON(input) {
|
|
734
749
|
var MAX_DEPTH = 6;
|
|
735
750
|
|
|
736
|
-
// 1.
|
|
751
|
+
// 1. Quick attempt
|
|
737
752
|
try {
|
|
738
753
|
return {
|
|
739
754
|
success: true,
|
|
740
755
|
data: JSON.parse(input)
|
|
741
756
|
};
|
|
742
757
|
} catch (e) {
|
|
743
|
-
//
|
|
758
|
+
// Continue with fixing
|
|
744
759
|
}
|
|
745
760
|
|
|
746
|
-
// 2. Simple
|
|
761
|
+
// 2. Simple unescaping of escaped \" (common case from pasted JS literals)
|
|
747
762
|
var s = input;
|
|
748
763
|
if (s.includes('\\"')) s = s.replace(/\\"/g, '"');
|
|
749
764
|
s = s.trim();
|
|
@@ -760,24 +775,54 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
760
775
|
data: JSON.parse(s)
|
|
761
776
|
};
|
|
762
777
|
} catch (err) {
|
|
778
|
+
var error = err instanceof Error ? err : new Error('Unknown error');
|
|
763
779
|
return {
|
|
764
780
|
success: false,
|
|
765
781
|
error: 'Invalid JSON format',
|
|
766
|
-
details:
|
|
782
|
+
details: error.message
|
|
767
783
|
};
|
|
768
784
|
}
|
|
769
785
|
}
|
|
770
786
|
|
|
771
|
-
/* ---------- Helper (
|
|
787
|
+
/* ---------- Helper (Recursive) Functions ---------- */
|
|
772
788
|
|
|
773
789
|
function processTopObject(str, depth, MAX_DEPTH) {
|
|
774
790
|
if (depth > MAX_DEPTH) return str;
|
|
775
791
|
str = str.trim();
|
|
776
|
-
|
|
792
|
+
|
|
793
|
+
// First check if braces match
|
|
794
|
+
var braceCount = 0;
|
|
795
|
+
var inString = false;
|
|
796
|
+
var escapeNext = false;
|
|
797
|
+
for (var i = 0; i < str.length; i++) {
|
|
798
|
+
var ch = str[i];
|
|
799
|
+
if (escapeNext) {
|
|
800
|
+
escapeNext = false;
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
if (ch === '\\') {
|
|
804
|
+
escapeNext = true;
|
|
805
|
+
continue;
|
|
806
|
+
}
|
|
807
|
+
if ((ch === '"' || ch === "'") && !escapeNext) {
|
|
808
|
+
inString = !inString;
|
|
809
|
+
continue;
|
|
810
|
+
}
|
|
811
|
+
if (!inString) {
|
|
812
|
+
if (ch === '{') braceCount++;else if (ch === '}') braceCount--;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if (braceCount !== 0) {
|
|
816
|
+
throw new Error('Invalid object: mismatched braces');
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// Ensure both ends are { ... }
|
|
777
820
|
if (!(str.startsWith('{') && str.endsWith('}'))) {
|
|
778
|
-
var f = str.indexOf('{')
|
|
779
|
-
|
|
780
|
-
if (f === -1 || l === -1 || l <= f)
|
|
821
|
+
var f = str.indexOf('{'),
|
|
822
|
+
l = str.lastIndexOf('}');
|
|
823
|
+
if (f === -1 || l === -1 || l <= f) {
|
|
824
|
+
throw new Error('Invalid object format: missing or mismatched braces');
|
|
825
|
+
}
|
|
781
826
|
str = str.slice(f, l + 1);
|
|
782
827
|
}
|
|
783
828
|
var inner = str.slice(1, -1);
|
|
@@ -802,8 +847,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
802
847
|
if (depth > MAX_DEPTH) return str;
|
|
803
848
|
str = str.trim();
|
|
804
849
|
if (!(str.startsWith('[') && str.endsWith(']'))) {
|
|
805
|
-
var f = str.indexOf('[')
|
|
806
|
-
|
|
850
|
+
var f = str.indexOf('['),
|
|
851
|
+
l = str.lastIndexOf(']');
|
|
807
852
|
if (f === -1 || l === -1 || l <= f) return str;
|
|
808
853
|
str = str.slice(f, l + 1);
|
|
809
854
|
}
|
|
@@ -819,21 +864,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
819
864
|
return '[' + processed.join(',') + ']';
|
|
820
865
|
}
|
|
821
866
|
|
|
822
|
-
// If
|
|
823
|
-
// If
|
|
824
|
-
// Otherwise return
|
|
867
|
+
// If it's a string wrapped in quotes, extract the inner content and JSON.stringify (safe escaping)
|
|
868
|
+
// If it's an object/array literal (not wrapped in quotes), recursively process (treat as new outermost layer)
|
|
869
|
+
// Otherwise return the original fragment directly (numbers/true/false/null or JS expressions)
|
|
825
870
|
function repairPossiblyQuotedValue(rawVal, depth, MAX_DEPTH) {
|
|
826
871
|
var v = rawVal.trim();
|
|
827
872
|
if (v === '') return v;
|
|
828
873
|
if (v[0] === '"' || v[0] === "'") {
|
|
829
874
|
var quote = v[0];
|
|
830
|
-
// Find the last unescaped
|
|
875
|
+
// Find the last unescaped same quote
|
|
831
876
|
var lastPos = -1;
|
|
832
877
|
for (var i = v.length - 1; i >= 0; i--) {
|
|
833
878
|
if (v[i] === quote) {
|
|
834
|
-
// check
|
|
835
|
-
var bs = 0
|
|
836
|
-
|
|
879
|
+
// check escaped
|
|
880
|
+
var bs = 0,
|
|
881
|
+
k = i - 1;
|
|
837
882
|
while (k >= 0 && v[k] === '\\') {
|
|
838
883
|
bs++;
|
|
839
884
|
k--;
|
|
@@ -845,10 +890,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
845
890
|
}
|
|
846
891
|
}
|
|
847
892
|
var inner = lastPos > 0 ? v.slice(1, lastPos) : v.slice(1);
|
|
848
|
-
return JSON.stringify(inner); //
|
|
893
|
+
return JSON.stringify(inner); // Use JSON.stringify to generate valid JSON string (automatically escape internal quotes, etc.)
|
|
849
894
|
}
|
|
850
895
|
|
|
851
|
-
// If
|
|
896
|
+
// If it's an object or array literal (not wrapped in quotes) -> recursively treat as new outermost layer
|
|
852
897
|
if (v.startsWith('{')) {
|
|
853
898
|
return processTopObject(v, depth, MAX_DEPTH);
|
|
854
899
|
}
|
|
@@ -856,22 +901,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
856
901
|
return processTopArray(v, depth, MAX_DEPTH);
|
|
857
902
|
}
|
|
858
903
|
|
|
859
|
-
//
|
|
904
|
+
// Others (numbers, boolean, null, or JS expressions): return as-is
|
|
860
905
|
return v;
|
|
861
906
|
}
|
|
862
907
|
|
|
863
|
-
/* ---------
|
|
908
|
+
/* --------- Utilities: Split by top-level commas, find top-level colon, extract key --------- */
|
|
864
909
|
|
|
865
|
-
// Split
|
|
910
|
+
// Split by top-level commas (ignore strings, sub-objects, sub-arrays, commas inside parentheses)
|
|
866
911
|
function splitTopLevel(str) {
|
|
867
912
|
var parts = [];
|
|
868
913
|
var buf = '';
|
|
869
|
-
var depthCurly = 0
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
var inSingle = false
|
|
873
|
-
|
|
874
|
-
|
|
914
|
+
var depthCurly = 0,
|
|
915
|
+
depthSquare = 0,
|
|
916
|
+
depthParen = 0;
|
|
917
|
+
var inSingle = false,
|
|
918
|
+
inDouble = false,
|
|
919
|
+
esc = false;
|
|
875
920
|
for (var i = 0; i < str.length; i++) {
|
|
876
921
|
var ch = str[i];
|
|
877
922
|
if (esc) {
|
|
@@ -933,18 +978,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
933
978
|
}
|
|
934
979
|
buf += ch;
|
|
935
980
|
}
|
|
981
|
+
|
|
982
|
+
// Check for unclosed brackets or quotes
|
|
983
|
+
if (depthCurly !== 0 || depthSquare !== 0 || depthParen !== 0 || inSingle || inDouble) {
|
|
984
|
+
throw new Error('Invalid JSON: unclosed brackets or quotes');
|
|
985
|
+
}
|
|
936
986
|
if (buf.trim() !== '') parts.push(buf);
|
|
937
987
|
return parts;
|
|
938
988
|
}
|
|
939
989
|
|
|
940
|
-
// Find the first top-level colon (
|
|
990
|
+
// Find the first "top-level" colon index (ignore inside strings & sub-levels)
|
|
941
991
|
function findTopLevelColon(str) {
|
|
942
|
-
var inSingle = false
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
var depthCurly = 0
|
|
946
|
-
|
|
947
|
-
|
|
992
|
+
var inSingle = false,
|
|
993
|
+
inDouble = false,
|
|
994
|
+
esc = false;
|
|
995
|
+
var depthCurly = 0,
|
|
996
|
+
depthSquare = 0,
|
|
997
|
+
depthParen = 0;
|
|
948
998
|
for (var i = 0; i < str.length; i++) {
|
|
949
999
|
var ch = str[i];
|
|
950
1000
|
if (esc) {
|
|
@@ -996,7 +1046,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
996
1046
|
return -1;
|
|
997
1047
|
}
|
|
998
1048
|
|
|
999
|
-
// Extract key content (supports "key", 'key', key)
|
|
1049
|
+
// Extract key content (supports "key", 'key', key), returns pure key string
|
|
1000
1050
|
function extractKeyContent(rawKey) {
|
|
1001
1051
|
var r = rawKey.trim();
|
|
1002
1052
|
if (r.startsWith('"') && r.endsWith('"') || r.startsWith("'") && r.endsWith("'")) {
|
|
@@ -1012,7 +1062,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1012
1062
|
*/
|
|
1013
1063
|
function _isJSON(input) {
|
|
1014
1064
|
if (typeof input === 'string' && input.length > 0) {
|
|
1015
|
-
return
|
|
1065
|
+
return fixAndParseJSON(input).success;
|
|
1016
1066
|
} else {
|
|
1017
1067
|
if (_typeof(input) === 'object' && Object.prototype.toString.call(input) === '[object Object]' && !input.length) {
|
|
1018
1068
|
return true;
|