Skip to content

Commit

Permalink
Shorten by one line
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Sep 24, 2024
1 parent e7b6aa0 commit e828dac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions tslib.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,9 @@ export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (extMatch) {
var ext = extMatch[0].toLowerCase();
var dot = path.lastIndexOf(".", path.length - (ext.length + 1));
if (dot >= 0 && (path.substring(dot - 2, dot).toLowerCase() === ".d" || path.substring(dot, dot + 2).toLowerCase() === ".d")) {
return path;
if (dot < 0 || !(path.substring(dot - 2, dot).toLowerCase() === ".d" || path.substring(dot, dot + 2).toLowerCase() === ".d")) {
return path.substring(0, path.length - ext.length) + (ext === ".mts" ? ".mjs" : ext === ".cts" ? ".cjs" : ".js");
}
return path.substring(0, path.length - ext.length) + (ext === ".mts" ? ".mjs" : ext === ".cts" ? ".cjs" : ".js");
}
}
return path;
Expand Down
5 changes: 2 additions & 3 deletions tslib.es6.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,9 @@ export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (extMatch) {
var ext = extMatch[0].toLowerCase();
var dot = path.lastIndexOf(".", path.length - (ext.length + 1));
if (dot >= 0 && (path.substring(dot - 2, dot).toLowerCase() === ".d" || path.substring(dot, dot + 2).toLowerCase() === ".d")) {
return path;
if (dot < 0 || !(path.substring(dot - 2, dot).toLowerCase() === ".d" || path.substring(dot, dot + 2).toLowerCase() === ".d")) {
return path.substring(0, path.length - ext.length) + (ext === ".mts" ? ".mjs" : ext === ".cts" ? ".cjs" : ".js");
}
return path.substring(0, path.length - ext.length) + (ext === ".mts" ? ".mjs" : ext === ".cts" ? ".cjs" : ".js");
}
}
return path;
Expand Down
5 changes: 2 additions & 3 deletions tslib.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,9 @@ var __rewriteRelativeImportExtension;
if (extMatch) {
var ext = extMatch[0].toLowerCase();
var dot = path.lastIndexOf(".", path.length - (ext.length + 1));
if (dot >= 0 && (path.substring(dot - 2, dot).toLowerCase() === ".d" || path.substring(dot, dot + 2).toLowerCase() === ".d")) {
return path;
if (dot < 0 || !(path.substring(dot - 2, dot).toLowerCase() === ".d" || path.substring(dot, dot + 2).toLowerCase() === ".d")) {
return path.substring(0, path.length - ext.length) + (ext === ".mts" ? ".mjs" : ext === ".cts" ? ".cjs" : ".js");
}
return path.substring(0, path.length - ext.length) + (ext === ".mts" ? ".mjs" : ext === ".cts" ? ".cjs" : ".js");
}
}
return path;
Expand Down

0 comments on commit e828dac

Please sign in to comment.