Leave a spaced dash out of the text of a match that ends before it

This commit is contained in:
dualfroz committed 2026-10-03 01:05:43 +02:00
1 parent 1bb20a37d2
commit 5a4cddfb00
4 files changed
+21 -1

No files matched your search

+6
View File
@@ -25,6 +25,12 @@ test('whitespace-out', function (t) {
t.end()
})
test('match before a spaced dash', function (t) {
t.equal(nlp('june 5 - they left').match('june 5').text(), 'june 5', here + 'first words')
t.equal(nlp('i saw john - he left').match('john').text(), 'john', here + 'middle word')
t.end()
})
test('pre/post concat', function (t) {
const doc = nlp(`Getting ready for whacking day? What's whacking day?`)
doc.post(' ', true)