Skip to content

Commit

Permalink
[twisty] Rename an internal function: `splitBeforeOnFirstOccurrence(……
Browse files Browse the repository at this point in the history
…)` → `sliceBeforeFirstOccurrence(…)`.
  • Loading branch information
lgarron committed Sep 7, 2023
1 parent 9846666 commit ddecd9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cubing/twisty/views/TwistyAlgEditor/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function maybeParse(str: string): Alg | null {

// If there is no occurence, the original string is returned in the first entry.
// If there is, the delimiter is included at the start of the second entry.
function splitBeforeOnFirstOccurrence(
function sliceBeforeFirstOccurrence(
str: string,
delimiter: string,
): [before: string, after: string] {
Expand All @@ -26,7 +26,7 @@ function splitBeforeOnFirstOccurrence(
function replaceSmartQuotesOutsideComments(str: string): string {
const linesOut = [];
for (const line of str.split("\n")) {
let [before, after] = splitBeforeOnFirstOccurrence(line, COMMENT_DELIMITER);
let [before, after] = sliceBeforeFirstOccurrence(line, COMMENT_DELIMITER);
before = before.replaceAll("’", "'");
linesOut.push(before + after);
}
Expand Down Expand Up @@ -58,7 +58,7 @@ export function pasteIntoTextArea(
// Replace smart quotes that are not in comments.
let replacement = pastedText;
if (pasteStartsWithCommentText) {
const [before, after] = splitBeforeOnFirstOccurrence(pastedText, "\n");
const [before, after] = sliceBeforeFirstOccurrence(pastedText, "\n");
replacement = before + replaceSmartQuotesOutsideComments(after);
} else {
replacement = replaceSmartQuotesOutsideComments(pastedText);
Expand Down

0 comments on commit ddecd9c

Please sign in to comment.