Run prettier
This commit is contained in:
parent
33c0b02973
commit
2542fd7bf4
13
src/utils.ts
13
src/utils.ts
|
@ -129,16 +129,21 @@ export function getHalfWidthTitleLength(title: string) {
|
||||||
|
|
||||||
export function sanitizeHalfWidthTitle(title: string) {
|
export function sanitizeHalfWidthTitle(title: string) {
|
||||||
enum CharType {
|
enum CharType {
|
||||||
normal, dakuten, handakuten
|
normal,
|
||||||
|
dakuten,
|
||||||
|
handakuten,
|
||||||
}
|
}
|
||||||
|
|
||||||
const handakutenPossible = 'はひふへほハヒフヘホ'.split("");
|
const handakutenPossible = 'はひふへほハヒフヘホ'.split('');
|
||||||
const dakutenPossible = "かきくけこさしすせそたちつてとカキクケコサシスセソタチツテト".split("").concat(handakutenPossible);
|
const dakutenPossible = 'かきくけこさしすせそたちつてとカキクケコサシスセソタチツテト'.split('').concat(handakutenPossible);
|
||||||
|
|
||||||
//'Flatten' all the characters followed by the (han)dakuten character into one
|
//'Flatten' all the characters followed by the (han)dakuten character into one
|
||||||
let dakutenFix = [];
|
let dakutenFix = [];
|
||||||
let type = CharType.normal;
|
let type = CharType.normal;
|
||||||
for (const char of sanitizeFullWidthTitle(title, true).split('').reverse()) { //This only works for full-width kana. It will get converted to half-width later anyway...
|
for (const char of sanitizeFullWidthTitle(title, true)
|
||||||
|
.split('')
|
||||||
|
.reverse()) {
|
||||||
|
//This only works for full-width kana. It will get converted to half-width later anyway...
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CharType.dakuten:
|
case CharType.dakuten:
|
||||||
if (dakutenPossible.includes(char)) {
|
if (dakutenPossible.includes(char)) {
|
||||||
|
|
Loading…
Reference in New Issue