LogoPixi’VN
indexNamespacesHashtagCommandsFunctions

Function: mergeJsonBlocks()

> mergeJsonBlocks(tokens): string[]

Defined in: src/handlers/hashtag-commands.ts:316

Merges valid JSON-like blocks delimited by { } into single strings.

Rules:

  • Braces must be balanced.
  • Inner blocks are processed before parent blocks.
  • Every generated block is validated with JSON5.parse().
  • If a block is invalid:
    • the block remains split
    • all parent blocks also remain split
  • Unmatched braces are treated as normal strings.

Parameters

tokens

string[]

Returns

string[]