(str: string, separator: string, limit?: number)
| 1 | export function splitStr(str: string, separator: string, limit?: number) { |
| 2 | const parts = str.split(separator); |
| 3 | |
| 4 | if (limit != null && parts.length > limit) { |
| 5 | const rest = parts.splice(limit - 1); |
| 6 | |
| 7 | parts.push(rest.join(separator)); |
| 8 | } |
| 9 | |
| 10 | return parts; |
| 11 | } |
| 12 | |
| 13 | const textEncoder = new TextEncoder(); |
| 14 | export function textToBytes(text: string): Uint8Array { |
no outgoing calls
no test coverage detected