Skip to content

Commit

Permalink
remove brackets 🐛, 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Aug 16, 2016
1 parent 8c5f55a commit 1897e27
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const tokenize = (station) =>
('string' !== typeof station || station.length === 0)
? []
: normalize(station)
.replace(/[\[\]]/g, ' ')
.replace(/(?:[^\w]|^)b\.(?=\s+\w+)/, 'bei ')
.split(delim)
.filter((x) => x.trim().length > 0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vbb-tokenize-station",
"description": "Make VBB station names search-safe.",
"version": "0.2.0",
"version": "0.2.1",
"main": "index.js",
"files": ["index.js"],
"keywords": ["vbb", "stations", "search", "url-safe", "slug"],
Expand Down
5 changes: 5 additions & 0 deletions test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ module.exports =
t.strictEqual tokenize('Foo Bar Baz').length, 3
t.done()

'removes brackets': (t) ->
t.strictEqual tokenize('Foo Bar [Baz]').length, 3
t.strictEqual tokenize('Foo Bar [Baz]')[2], 'baz'
t.done()

'returns lower case tokens': (t) ->
r = tokenize 'Foo BAR baz'
t.strictEqual r[0], 'foo'
Expand Down

0 comments on commit 1897e27

Please sign in to comment.