Skip to content

Commit c78f029

Browse files
committed
feat: improve splitString
1 parent 7c866c1 commit c78f029

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/sessionManager/utils.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,5 @@ export function splitString(str: string, length: number): string[] {
22
if (length <= 0) {
33
return [];
44
}
5-
const result = [];
6-
for (let i = 0; i < str.length; i += length) {
7-
result.push(str.slice(i, i + length));
8-
}
9-
return result;
5+
return str.match(new RegExp(`.{1,${length}}`, 'g')) || [];
106
}

0 commit comments

Comments
 (0)