Description
Clear and concise description of the problem
As a developer using VueUse I am very happy to use many functions provided by this library, but as for me it would be useful to implement such a basic utility as string truncation, so that each time I do not implement my own helper, or resort to installing an external library for this particular function.
Suggested solution
In module Utilities we could provide following implementation the useTruncateString function (since there is a useTrunc function, I believe that such a name indicated the specific purpose of the new function).
The function would accept a string to be truncated, as well as an options object:
length - the length of the truncated string
omission - a string to insert at the end of the truncated string (default "...")
separator - a pattern for truncation (for example, by space or comma)
Alternative
Of course a function with such functionality is implemented in lodash, but I think such a basic function would be useful by default in VueUse
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.