Skip to content

Commit 50cdd22

Browse files
committed
Fix sort-keys issues
1 parent 8dd145e commit 50cdd22

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

root/static/scripts/guess-case/modes.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,30 @@ function runFixes(is, fixes) {
137137
const DefaultMode = {
138138
description: '',
139139

140+
/*
141+
* Delegate function for mode-specific word handling. This is mostly used
142+
* for context-based title changes.
143+
*
144+
* @return `false`, such that the normal word handling can take place for
145+
* the current word. If that should not be done, return `true`.
146+
*/
147+
doWord() {
148+
return false;
149+
},
150+
151+
/*
152+
* Look for and convert vinyl expressions.
153+
* - Look only at substrings which start with ' ' or '('.
154+
* - Convert 7', 7'', 7", 7in, and 7inch to '7" ' (followed by space).
155+
* - Convert 12', 12'', 12", 12in, and 12inch to '12" ' (followed by space).
156+
* - Do not convert strings like 80's.
157+
*/
158+
fixVinylSizes(is) {
159+
return is
160+
.replace(/(\s+|\()(7|10|12)(?:inch\b|in\b|'|''|")([^s]|$)/ig, '$1$2"$3')
161+
.replace(/((?:\s+|\()(?:7|10|12)")([^),\s])/, '$1 $2');
162+
},
163+
140164
isLowerCaseWord(w) {
141165
return LOWER_CASE_WORDS.test(w);
142166
},
@@ -155,14 +179,6 @@ const DefaultMode = {
155179

156180
name: '',
157181

158-
toLowerCase(str) {
159-
return str.toLowerCase();
160-
},
161-
162-
toUpperCase(str) {
163-
return str.toUpperCase();
164-
},
165-
166182
/*
167183
* Pre-process to find any lowercase_bracket word that needs to be put into
168184
* parentheses. Starts from the back and collects words that belong into the
@@ -259,28 +275,12 @@ const DefaultMode = {
259275
return runFixes(is, POSTPROCESS_FIXLIST);
260276
},
261277

262-
/*
263-
* Look for and convert vinyl expressions.
264-
* - Look only at substrings which start with ' ' or '('.
265-
* - Convert 7', 7'', 7", 7in, and 7inch to '7" ' (followed by space).
266-
* - Convert 12', 12'', 12", 12in, and 12inch to '12" ' (followed by space).
267-
* - Do not convert strings like 80's.
268-
*/
269-
fixVinylSizes(is) {
270-
return is
271-
.replace(/(\s+|\()(7|10|12)(?:inch\b|in\b|'|''|")([^s]|$)/ig, '$1$2"$3')
272-
.replace(/((?:\s+|\()(?:7|10|12)")([^),\s])/, '$1 $2');
278+
toLowerCase(str) {
279+
return str.toLowerCase();
273280
},
274281

275-
/*
276-
* Delegate function for mode-specific word handling. This is mostly used
277-
* for context-based title changes.
278-
*
279-
* @return `false`, such that the normal word handling can take place for
280-
* the current word. If that should not be done, return `true`.
281-
*/
282-
doWord() {
283-
return false;
282+
toUpperCase(str) {
283+
return str.toUpperCase();
284284
},
285285
};
286286

0 commit comments

Comments
 (0)