MCPcopy Create free account
hub / github.com/zxlie/FeHelper / unpackTopLevelEscapedJSON

Function unpackTopLevelEscapedJSON

apps/json-format/index.js:1725–1751  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1723}
1724
1725function unpackTopLevelEscapedJSON(value) {
1726 if (typeof value !== 'string' || !value.trim()) {
1727 return value;
1728 }
1729
1730 try {
1731 const parsed = parseWithBigInt(value);
1732 if (
1733 typeof parsed === 'object' &&
1734 parsed !== null &&
1735 (Array.isArray(parsed) || Object.prototype.toString.call(parsed) === '[object Object]') &&
1736 !(
1737 parsed &&
1738 typeof parsed.s === 'number' &&
1739 typeof parsed.e === 'number' &&
1740 Array.isArray(parsed.c) &&
1741 Object.keys(parsed).length === 3
1742 )
1743 ) {
1744 return deepParseJSONStrings(parsed);
1745 }
1746 } catch (e) {
1747 // 保持原字符串,沿用旧行为
1748 }
1749
1750 return value;
1751}
1752
1753
1754function isInsideQuotedSegment(text, offset) {

Callers 2

json-utils.test.jsFile · 0.90
index.jsFile · 0.70

Calls 2

parseWithBigIntFunction · 0.70
deepParseJSONStringsFunction · 0.70

Tested by

no test coverage detected