Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "vbb-util", | ||
"description": "JavaScript utilites for the VBB API client.", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"main": "./src/index", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -7,4 +7,5 @@ module.exports = { | ||
searchableName: function (name) { | ||
return name | ||
tokenize: function (name) { | ||
var result = name | ||
.toLowerCase() | ||
@@ -17,19 +18,24 @@ // German umlauts | ||
// remove abbreviations | ||
.replace(/^[SU](\+[SU])?\W/, ' ') | ||
// expand abbreviations | ||
.toLowerCase() | ||
.replace(/\(pl\)/g, ' polen ') | ||
.replace(/\(berlin\)/g, ' berlin ') | ||
.replace(/\(bln\)/g, ' berlin ') | ||
.replace(/str\.?$/, 'strasse') | ||
.replace(/str\.?\W/g, 'strasse ') | ||
.replace(/bhf\.?$/, 'bahnhof') | ||
.replace(/bhf\.?\W/g, 'bahnhof ') | ||
.replace(/\(pl\)/g, 'polen') | ||
.replace(/\(berlin\)/g, 'berlin') | ||
.replace(/\(bln\)/g, 'bln') | ||
.replace(/^[SU](\+[SU])?\W/, ' ') // remove `S+U` abbreviations | ||
.split(/[\s\/\(\)]+/); | ||
var i; | ||
for (i = 0; i < result.length; i++) { | ||
result[i] = result[i] | ||
// expand abbreviations | ||
.replace(/str\.?/, 'strasse') | ||
.replace(/bhf\.?/, 'bahnhof') | ||
.replace(/hbf\.?/, 'hauptbahnhof'); | ||
} | ||
return result | ||
.join(' ') | ||
// special chars | ||
.replace(/[^\w\s]/g, ' ') | ||
.replace(/_/g, ' ') | ||
.replace(/[^\w]|_/g, ' ') | ||
.replace(/\s{2,}/g, ' ') | ||
@@ -36,0 +42,0 @@ .trim(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12456
476