esamattis / esamattis/underscore.string
Unexpected results trimming with words()
- Dominant language
- JavaScript
- Stars
- 3.4k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
I use _.words in a few places in my code to split natural English phrases on certain keywords. This works just as I expect most of the time. With one keyword (maybe more as I try more words?) the words in my result list sometimes get trimmed. The trimmed characters seem to have a connection to the characters in my delimiter string.
My delimiting string in this case is " with ". Here are some examples:
_.words("Window with Area > 100", " with ");
["Window", "Area > 100"]
_.words("Window", " with ");
["Windo"]
_.words("West with Area > 100", " with ");
["West", "Area > 100"]
_.words("West", " with ");
["Wes"]
Am I doing something wrong or is this intended somehow? Apologies if this has been reported. I search through the existing issues and didn't find anything relevant.
Contributor guide
Assessment
This issue has not been assessed yet.