sodiray / radash

Functional utility library - modern, simple, typed, powerful
https://radash-docs.vercel.app
MIT License
4.31k stars 173 forks source link

`trim` throws on edge cases #250

Closed apstanisic closed 1 year ago

apstanisic commented 1 year ago

runkit link

Run bellow code, it throws:

radash.trim(" __-_ hello", "_- ")

Error

SyntaxError: Invalid regular expression: /^[_- ]+|[_- ]+$/: Range out of order in character class

I can open PR

PS Are you open for adding trimStart and trimEnd?

sodiray commented 1 year ago

Oh wow, that's an awful bug. I think trimStart and trimEnd would be great additions 👍