Skip to content

Conversation

@Omkarthipparthi
Copy link

Fix return format for processStyledBidirectionalText with empty input

The processStyledBidirectionalText function was returning an incorrect format when given empty text. It returned [{text, styleIndices}] (an object wrapped in an array) instead of [[text, styleIndices]] (a tuple/array wrapped in an array).

This caused issues in maplibre-gl-js when both name and ref fields were empty (see maplibre/maplibre-gl-js#6444).

Changes:

  • Fixed line 162 in src/index.js to return [[text, styleIndices]]
  • Added test case to prevent regression

The fix ensures consistency with the function's documented return type: Array<[string, Array<number>]>

@HarelM
Copy link

HarelM commented Oct 27, 2025

@stepankuzmin @ThibaudLopez can you guys take a look at this PR and hopefully merge and release a new version?

Thanks @Omkarthipparthi!

@Omkarthipparthi Omkarthipparthi changed the title Add test for empty text handling in styled bidirectional processing Fix bug and add test for empty text handling in styled bidirectional processing Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants