Skip to content

Commit

Permalink
chore(perf): replace startsWith with === (#11124)
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-leong authored Jun 14, 2024
1 parent 70773d0 commit 8cf357e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-sfc/src/script/resolveType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ function importSourceToScope(

const filename = osSpecificJoinFn(dirname(scope.filename), source)
resolved = resolveExt(filename, fs)
} else if (source.startsWith('.')) {
} else if (source[0] === '.') {
// relative import - fast path
const filename = joinPaths(dirname(scope.filename), source)
resolved = resolveExt(filename, fs)
Expand Down
3 changes: 1 addition & 2 deletions scripts/size-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ async function run() {
}

async function renderFiles() {
const filterFiles = (files: string[]) =>
files.filter(file => !file.startsWith('_'))
const filterFiles = (files: string[]) => files.filter(file => file[0] !== '_')

const curr = filterFiles(await readdir(currDir))
const prev = existsSync(prevDir) ? filterFiles(await readdir(prevDir)) : []
Expand Down

0 comments on commit 8cf357e

Please sign in to comment.