chore: remove all .substring() usage (#6352)

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
CommanderRoot
2022-03-30 13:25:12 +02:00
committed by GitHub
parent 59b9348093
commit ad82a0f0bc
8 changed files with 12 additions and 21 deletions

View File

@ -319,11 +319,7 @@ export default function withFileControl({ forImage } = {}) {
if (!value || value.length <= size) {
return value;
}
// eslint-disable-next-line unicorn/prefer-string-slice
const text = `${value.substring(0, size / 2)}\u2026${value.substring(
value.length - size / 2 + 1,
value.length,
)}`;
const text = `${value.slice(0, size / 2)}\u2026${value.slice(-(size / 2) + 1)}`;
return (
<FileLink href={value} rel="noopener" target="_blank">
{text}