8000 test: add test for size with string input by frontman-git · Pull Request #5996 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@frontman-git
Copy link

Adds a test to verify that _.size correctly returns the length of string values.

This ensures that string inputs like 'hi' return the expected length (2), aligning with Lodash documentation and behavior for string primitives.

@jonchurch
Copy link
Member

pushed a commit to capture the unicode behavior of _.size

for string _.size relies on stringSize, which also relies on unicodeSize

Copy link
Member
@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

i'm pretty sure this is incorrect - _.size counts enumerable own string-keyed properties, not code unit pairs or graphemes.

@ljharb
Copy link
Member
ljharb commented Dec 18, 2025

sorry for the back and forth, but all the docs i can find suggest it's wrong. if it's right then this PR should fix all the docs also.

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.

4 participants

0