Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace indexOf === 0 with startsWith #68116

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function normalizeSourceMap(map: any, resourcePath: string) {
// We should normalize path because previous loaders like `sass-loader` using backslash when generate source map
newMap.sources = newMap.sources.map((source: string) => {
// Non-standard syntax from `postcss`
if (source.indexOf('<') === 0) {
if (source.startsWith('<')) {
return source
}

Expand Down Expand Up @@ -297,7 +297,7 @@ function normalizeSourceMapForRuntime(map: any, loaderContext: any) {

resultMap.sources = resultMap.sources.map((source: string) => {
// Non-standard syntax from `postcss`
if (source.indexOf('<') === 0) {
if (source.startsWith('<')) {
return source
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function normalizeSourceMapAfterPostcss(map: any, resourceContext: string) {

// eslint-disable-next-line no-param-reassign
newMap.sources = newMap.sources.map((source: string) => {
if (source.indexOf('<') === 0) {
if (source.startsWith('<')) {
return source
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function formatMessage(
}

// Cleans up verbose "module not found" messages for files and packages.
if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {
if (lines[1] && lines[1].startsWith('Module not found: ')) {
lines = [
lines[0],
lines[1]
Expand Down
Loading