new release #190
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Function will replace the middle of the string with 3 dots if length greater then
|
||||
* Function will replace the middle of the string with ellipsis if length greater then
|
||||
* offset value
|
||||
* @param str string to shorten
|
||||
* @param offset of how many chars to keep in the beginning and the end
|
||||
@ -9,10 +9,7 @@ export const shorten = (str: string, offset = 9) => {
|
||||
// return original string if it is not long enough
|
||||
if (str.length < offset * 2 + 4) return str
|
||||
|
||||
return `${str.slice(0, offset)}...${str.slice(
|
||||
str.length - offset,
|
||||
str.length
|
||||
)}`
|
||||
return `${str.slice(0, offset)}…${str.slice(str.length - offset, str.length)}`
|
||||
}
|
||||
|
||||
export const stringToHex = (str: string) => {
|
||||
|
Loading…
Reference in New Issue
Block a user