Skip to content

Commit

Permalink
use RegExp.prototype.test
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert authored and danny-andrews committed Oct 13, 2017
1 parent 05f08eb commit ba36909
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/rules/no-useless-path-segments.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import moduleVisitor from 'eslint-module-utils/moduleVisitor'
**/
function toRel(rel) {
const stripped = rel.replace(/\/$/g, '')
return stripped.match(/^((\.\.)|(\.))($|\/)/) ?
stripped :
`./${stripped}`
return /^((\.\.)|(\.))($|\/)/.test(stripped) ? stripped : `./${stripped}`
}

function normalize(fn) {
Expand Down

0 comments on commit ba36909

Please sign in to comment.