Sha256: cc2900f724fdfa00b3484467c84f4bff1706cb89c911ec46a8f89cd85ded82f7
Contents?: true
Size: 350 Bytes
Versions: 13
Compression:
Stored size: 350 Bytes
Contents
export const truncateFilename = (filename, maxLength = 31) => { if (filename.length <= maxLength) { return filename; } const charactersFromBegin = Math.floor(maxLength / 2) - 3; const charactersFromEnd = maxLength - charactersFromBegin - 3; return `${filename.slice(0, charactersFromBegin)}...${filename.slice(-charactersFromEnd)}`; }
Version data entries
13 entries across 13 versions & 1 rubygems