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
Use startsWith and endsWith when possible. #429
Conversation
10e654e
to
b19bb91
Compare
src/file.js
Outdated
@@ -35,11 +35,15 @@ function normalizePath(str) { | |||
|
|||
/** | |||
* Check whether a resource is external or not | |||
* @param {string} href Path | |||
* @param {string|Vinyl} href Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super familiar with jsdoc so please confirm this is right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be ;)
Do you have a hint to start debugging where the Vinyl object is coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens in one of the vinyl tests. I'll revert this part so that we get more info.
src/file.js
Outdated
* @returns {boolean} True if the path is remote | ||
*/ | ||
function isRemote(href) { | ||
return /(^\/\/)|(:\/\/)/.test(href) && !href.startsWith('file:'); | ||
if (isVinyl(href)) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up adding a separate check for Vinyl
. I'm not sure if the test is right; if it is then this check makes sense. If not, we should change the test @bezoerb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isRemote
function shouldn't intentionally receive a vinyl object. Until we find out where the vinyl is coming from the test should be something like this:
if (isVinyl(href)) {
// Check custom attribute set in the vinylize function
return Boolean(href.remote)
}
b19bb91
to
0dabe1b
Compare
Makes the intention clearer.
0dabe1b
to
f8dafa2
Compare
1cc0d9e
to
f8a2687
Compare
@bezoerb please check now, you should see the failure |
Makes the intention clearer.
TODO: