( text: string, maxWidth: number, wrapType: Styles['textWrap'], )
| 51 | } |
| 52 | |
| 53 | export default function wrapText( |
| 54 | text: string, |
| 55 | maxWidth: number, |
| 56 | wrapType: Styles['textWrap'], |
| 57 | ): string { |
| 58 | if (text.length <= MAX_CACHEABLE_TEXT_LENGTH) { |
| 59 | const key = wrapCacheKey(text, maxWidth, wrapType) |
| 60 | const cached = wrapCache.get(key) |
| 61 | if (cached !== undefined) return cached |
| 62 | |
| 63 | const result = computeWrap(text, maxWidth, wrapType) |
| 64 | wrapCache.set(key, result) |
| 65 | return result |
| 66 | } |
| 67 | |
| 68 | return computeWrap(text, maxWidth, wrapType) |
| 69 | } |
| 70 | |
| 71 | function computeWrap( |
| 72 | text: string, |
no test coverage detected