Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 10f0612

Browse files
committed
Improve splitBy method
1 parent 2f8fa6a commit 10f0612

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

shared/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export default {
3333
}
3434
return s
3535
},
36-
splitBy(s: string, searchString: string): [string, string] {
37-
const i = s.indexOf(searchString)
36+
splitBy(s: string, searchString: string, fromLast = false): [string, string] {
37+
const i = fromLast ? s.lastIndexOf(searchString) : s.indexOf(searchString)
3838
if (i >= 0) {
3939
return [s.slice(0, i), s.slice(i + 1)]
4040
}

0 commit comments

Comments
 (0)