File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -366,21 +366,30 @@ const getPartsOfArrayContent = (
366366 const length = match . index - arrayPayloadIndex ;
367367 const payload = serializedJson . substr ( arrayPayloadIndex , length ) ;
368368
369- //ToDo filter brackets in strings
369+ const stringMatches = getFindResultsByGlobalRegExp ( payload , regexString ) ;
370+ let filteredPayload = payload ;
371+
372+ // Replace content of strings with placeholders to avoid counting brackets inside them
373+ stringMatches . forEach ( ( stringMatch ) => {
374+ const stringContent = stringMatch . match ;
375+ const placeholder = '_' . repeat ( stringContent . length ) ;
376+ filteredPayload = filteredPayload . replace ( stringContent , placeholder ) ;
377+ } ) ;
378+
370379 const countOpenCurlyBracketsInPayload = getFindResultsByGlobalRegExp (
371- payload ,
380+ filteredPayload ,
372381 / \{ / g,
373382 ) . length ;
374383 const countClosedCurlyBracketsInPayload = getFindResultsByGlobalRegExp (
375- payload ,
384+ filteredPayload ,
376385 / \} / g,
377386 ) . length ;
378387 const countOpenSquaredBracketsInPayload = getFindResultsByGlobalRegExp (
379- payload ,
388+ filteredPayload ,
380389 / \[ / g,
381390 ) . length ;
382391 const countClosedSquaredBracketsInPayload = getFindResultsByGlobalRegExp (
383- payload ,
392+ filteredPayload ,
384393 / \] / g,
385394 ) . length ;
386395 const openCurlyBrackets =
You can’t perform that action at this time.
0 commit comments