Keep the case of a noun when making it singular

This commit is contained in:
dualfroz committed 2026-09-23 12:36:14 +02:00
1 parent 064b048c83
commit a29ba6095c
2 files changed
+35 -2

No files matched your search

+15 -1
View File
@@ -256,4 +256,18 @@ test('toSingular - longer:', function (t) {
t.equal(doc.text(), a[1], here + '[longer] ' + a[0])
})
t.end()
})
})
test('toSingular - keeps case:', function (t) {
const arr = [
[`Those are Great Danes`, `Those are Great Dane`],
[`The Children played`, `The Child played`],
[`I saw Mice`, `I saw Mouse`],
[`I saw MICE`, `I saw MOUSE`],
]
arr.forEach(function (a) {
const doc = nlp(a[0])
doc.nouns().toSingular()
t.equal(doc.text(), a[1], here + '[case] ' + a[0])
})
t.end()
})