shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
truncate
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.string
Truncate a string to a specific length and add an ellipsis at the end
Params
- str*-String
The string to truncate
- length*-Number
The length to truncate to
- settings{}Partial<TTruncateSettings>
Some settings to configure your truncate process
Return
- -String
The truncated string
Example
import truncate from '@blackbyte/sugar/string';
truncate('Hello world', 5); // => Hello...Settings
- ellipsis’…’String
The ellipsis to add at the end of the truncated string
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space