Skip to content

Commit

Permalink
fix: does not return after resolve match
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed May 11, 2020
1 parent 287bcd1 commit c7eb7cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const db = require('./icons/icon-tables.js')
const bestMatch = name =>
new Promise((resolve, reject) => {
if (name.endsWith('/')) {
resolve(db.matchName(name.slice(0, -1), true))
return resolve(db.matchName(name.slice(0, -1), true))
}

const matches = [
Expand All @@ -27,7 +27,7 @@ const bestMatch = name =>
const matchCount = matched.length
if (matchCount) {
if (matchCount > 1) matched.sort((a, b) => b.priority - a.priority)
resolve(matched[0])
return resolve(matched[0])
}
resolve(null)
})
Expand Down

0 comments on commit c7eb7cd

Please sign in to comment.