Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format semicolon-delimited value lists in labels #666

Merged
merged 4 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/constants/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function replaceExpression(
* Increasing this constant deepens recursion for replacing delimiters in the
* list, potentially affecting style loading performance.
*/
const maxValueListLength = 9;
const maxValueListLength = 3;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three values separated by two semicolons is plenty enough for the names currently using semicolons. In the future, with a more efficient string replacement implementation, we can add support for more semicolons, which will make this option more attractive to mappers currently using informal delimiters like spaces.


/**
* Returns an expression interpreting the given string as a list of tag values,
Expand Down
4 changes: 2 additions & 2 deletions test/spec/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,14 +518,14 @@ describe("label", function () {
"、"
)
).to.be.eql(
"马岔河村、菜园村、刘灿东村后于口村王石楼村李岔河村岔河新村富康新村前鱼口村"
"马岔河村、菜园村、刘灿东村;后于口村;王石楼村;李岔河村;岔河新村;富康新村;前鱼口村"
);
expect(
evaluatedExpression(
"one;two;three;four;five;six;seven;eight;nine;ten",
", "
)
).to.be.eql("one, two, three, four, five, six, seven, eight, nine;ten");
).to.be.eql("one, two, three;four;five;six;seven;eight;nine;ten");
});
});
});