Skip to content

Commit 6ae4c80

Browse files
committed
Fix case-sensitivity
1 parent 663b41d commit 6ae4c80

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var toString = require('nlcst-to-string');
66

77
module.exports = mentions;
88

9-
var name = /^(?:[a-z0-9]{1,2}|[a-z0-9][a-z0-9-]{1,37}[a-z0-9])$/;
9+
var name = /^(?:[a-z0-9]{1,2}|[a-z0-9][a-z0-9-]{1,37}[a-z0-9])$/i;
1010

1111
function mentions() {
1212
return transformer;

test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ test('mentions()', function (t) {
4040
'should work'
4141
);
4242

43+
t.deepEqual(
44+
noPosition.runSync(noPosition.parse('This @MikeMcQuaid that.')),
45+
u('RootNode', [
46+
u('ParagraphNode', [
47+
u('SentenceNode', [
48+
u('WordNode', [u('TextNode', 'This')]),
49+
u('WhiteSpaceNode', ' '),
50+
u('SourceNode', '@MikeMcQuaid'),
51+
u('WhiteSpaceNode', ' '),
52+
u('WordNode', [u('TextNode', 'that')]),
53+
u('PunctuationNode', '.')
54+
])
55+
])
56+
]),
57+
'should be case-insensitive'
58+
);
59+
4360
t.deepEqual(
4461
noPosition.runSync(noPosition.parse('One letter: @t & too long: @0123456789012345678901234567890123456789, @perfect.')),
4562
u('RootNode', [

0 commit comments

Comments
 (0)