Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
boarwell committed Mar 24, 2022
1 parent 98733cf commit 29fc07b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
42 changes: 21 additions & 21 deletions src/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hira2kata, hira2kataAll, kata2hira, kata2hiraAll } from './main.js';
import { hira2kata, hira2kataAll, kata2hira, kata2hiraAll } from "./main.js";

type Case = {
input: string;
Expand All @@ -7,11 +7,11 @@ type Case = {

const test_hira2kata = () => {
const cases: Case[] = [
{ input: 'あ', expected: 'ア' },
{ input: 'を', expected: 'ヲ' },
{ input: 'こ', expected: 'コ' },
{ input: 'z', expected: 'Ú' },
{ input: '愛', expected: '慻' }
{ input: "あ", expected: "ア" },
{ input: "を", expected: "ヲ" },
{ input: "こ", expected: "コ" },
{ input: "z", expected: "Ú" },
{ input: "愛", expected: "慻" },
];

const failedCases = cases.filter(
Expand All @@ -22,7 +22,7 @@ const test_hira2kata = () => {
return;
}

console.error('[Failed]: hira2kata()');
console.error("[Failed]: hira2kata()");
for (const { input, expected } of failedCases) {
console.error(
`input: ${input}, expected ${expected}, but got ${hira2kata(input)}`
Expand All @@ -32,9 +32,9 @@ const test_hira2kata = () => {

const test_hira2kataAll = () => {
const cases: Case[] = [
{ input: 'こんにちは', expected: 'コンニチハ' },
{ input: '今日は', expected: '今日ハ' },
{ input: 'GoとRust', expected: 'GoトRust' }
{ input: "こんにちは", expected: "コンニチハ" },
{ input: "今日は", expected: "今日ハ" },
{ input: "GoとRust", expected: "GoトRust" },
];

const failedCases = cases.filter(
Expand All @@ -45,7 +45,7 @@ const test_hira2kataAll = () => {
return;
}

console.error('[Failed]: hira2kata()');
console.error("[Failed]: hira2kata()");
for (const { input, expected } of failedCases) {
console.error(
`input: ${input}, expected ${expected}, but got ${hira2kataAll(input)}`
Expand All @@ -55,11 +55,11 @@ const test_hira2kataAll = () => {

const test_kata2hira = () => {
const cases: Case[] = [
{ input: 'ア', expected: 'あ' },
{ input: 'ヲ', expected: 'を' },
{ input: 'コ', expected: 'こ' },
{ input: 'Ú', expected: 'z' },
{ input: '慻', expected: '愛' }
{ input: "ア", expected: "あ" },
{ input: "ヲ", expected: "を" },
{ input: "コ", expected: "こ" },
{ input: "Ú", expected: "z" },
{ input: "慻", expected: "愛" },
];

const failedCases = cases.filter(
Expand All @@ -70,7 +70,7 @@ const test_kata2hira = () => {
return;
}

console.error('[Failed]: kata2hira()');
console.error("[Failed]: kata2hira()");
for (const { input, expected } of failedCases) {
console.error(
`input: ${input}, expected ${expected}, but got ${kata2hira(input)}`
Expand All @@ -80,9 +80,9 @@ const test_kata2hira = () => {

const test_kata2hiraAll = () => {
const cases: Case[] = [
{ input: 'コンニチハ', expected: 'こんにちは' },
{ input: '今日ハ', expected: '今日は' },
{ input: 'GoトRust', expected: 'GoとRust' }
{ input: "コンニチハ", expected: "こんにちは" },
{ input: "今日ハ", expected: "今日は" },
{ input: "GoトRust", expected: "GoとRust" },
];

const failedCases = cases.filter(
Expand All @@ -93,7 +93,7 @@ const test_kata2hiraAll = () => {
return;
}

console.error('[Failed]: kata2hiraAll()');
console.error("[Failed]: kata2hiraAll()");
for (const { input, expected } of failedCases) {
console.error(
`input: ${input}, expected ${expected}, but got ${kata2hiraAll(input)}`
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const hira2kata = (c: string): string =>
* hira2kataAll('今日は');
*/
export const hira2kataAll = (s: string): string =>
[...s].map(c => (isHiragana(c) ? hira2kata(c) : c)).join('');
[...s].map((c) => (isHiragana(c) ? hira2kata(c) : c)).join("");

/**
* converts the first character of the argument to a Hiragana (if it is Katakana).
Expand Down Expand Up @@ -74,7 +74,7 @@ export const kata2hira = (c: string): string =>
* hira2kataAll('今日ハ');
*/
export const kata2hiraAll = (s: string): string =>
[...s].map(c => (isKatakana(c) ? kata2hira(c) : c)).join('');
[...s].map((c) => (isKatakana(c) ? kata2hira(c) : c)).join("");

/**
* Code point of 'ぁ', first Hiragana in Unicode.
Expand Down

0 comments on commit 29fc07b

Please sign in to comment.