-
Notifications
You must be signed in to change notification settings - Fork 12
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
splitWordsRegex fails on iOS 16 #80
Comments
Hi @acorn1010, thanks for the suggestion. I will answer this step by step. Your regex doesn't account for this case:
But I agree that we should at least make it compatible with Safari 15. I will see what good replacements are out there when I have the time. |
I decided to do this to have a more readable syntax. All ranges in moderndash include the last parameter. In randomInt and randomFloat the last parameter is also included in the range. |
The issue got autoclosed with merging the PR. We can still discuss if it makes sense to modify inputs in merge. |
Sorry about the original RegEx—just noticed there were tests! This one should cover everything in the tests, plus some other edge cases like "enable6HFormat" -> ["enable", "6H", "Format"] while still maintaining a small file size: const splitWordsRegex = /(\d*[a-z]+)|([A-Z][a-z]+)|(\d*[A-Z]+(?=[^a-z]|$))|(\d+)/g; (I got the enable6HFormat from here: https://github.com/lodash/lodash/blob/4.17.11/test/test.js#L2351) P.S. The fallback works! |
Thanks, this is a much simpler solution. I deployed it in 3.3.1. It is 10% slower than my lookbehind solution, but the |
@acorn1010 opened a new issue for the array mutations, where we can discuss this further. ⬆️ |
Safari iOS below 16.3 doesn't support certain group specifiers in the below RegEx, probably lookbehind: https://caniuse.com/?search=lookbehind.
I haven't fully tested it, but what about replacing this
splitWords
function with something like:Other issues I've encountered with switching from Lodash to moderndash on a medium-size project:
{...{}, ...b}
) could be used in most cases. I've personally used Lodash'smerge
in areas of my code specifically because it modifies the input, cutting down on garbage collection.The text was updated successfully, but these errors were encountered: