aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-14 19:04:15 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-14 19:04:15 +0200
commit3dc9484fc81db8f3c8ffd4ebb4bab042e66c6214 (patch)
tree047c2d28407935c503ba6d672592bb9c67723388 /util
parent948d2311a0fdf2bb5641861824e6c629d1f2a93d (diff)
more improvements (failing tests down to 540)
Diffstat (limited to 'util')
-rw-r--r--util/japanese.ts3
-rw-r--r--util/string.ts2
2 files changed, 3 insertions, 2 deletions
diff --git a/util/japanese.ts b/util/japanese.ts
index 8814e11..d32714c 100644
--- a/util/japanese.ts
+++ b/util/japanese.ts
@@ -121,7 +121,8 @@ String.prototype.katakanaOnly = function(strict = false) {
}
String.prototype.kanjiOnly = function(strict = false) {
- return stringOnly(this as string, (key, val) => {
+ let temp = this.replaceAll("々", "力"); // kanjiOnly should return true for kanji repeat mark as well
+ return stringOnly(temp, (key, val) => {
if (key == UnicodeRange.JapaneseKanji)
return StringOnlyReturnValue.TallyAdd; // count kanji characters
else if (!strict && key.startsWith("any-"))
diff --git a/util/string.ts b/util/string.ts
index 4704d03..250a304 100644
--- a/util/string.ts
+++ b/util/string.ts
@@ -103,7 +103,7 @@ String.prototype.range = function() {
}
String.prototype.rangeTally = function() {
- var tally = Object.keys(UnicodeRange).reduce((a: any,c) => (a[c] = 0, a), {}) as RangeTally;
+ var tally = Object.values(UnicodeRange).reduce((a: any,c) => (a[c] = 0, a), {}) as RangeTally;
for (var char of this) tally[char.range()]++;
return tally;
};