antonioru / antonioru/deep-waters
isURL function is not working as expected in some cases
- 主要言語
- JavaScript
- スター
- 201
- フォーク
- 8
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi,
First of all, I want to congratulate the author because I believe this is a very promising project. And you've obviously put a lot of time into this. If there is any way I can help, please let me know.
Now, to the point: I've been looking into the code and I've found that the isURL function is not always working as expected. For example, the following code returns true:
```
const DW = require("deep-waters");
console.log(DW.isURL("www.google"));
```
As you mentioned in the comments of [isURL.js](https://github.com/antonioru/deep-waters/blob/master/src/isURL.js), the code for this function is derived from [this Stackoverflow question](https://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-a-url). The example I've used above was also already mentioned in the comments on Stackoverflow as an invalid example.
Now, the question "what is a valid URL?" is indeed quire ambiguous. But to me, "www.google" should return false for this function. In any case, it would be best to either include specific documentation/examples to explain what works and what not. Were you thinking about also adding more documentation to this project?
As a second measure, we can try to improve the regular expression so that it returns false for these type of cases.
What do you think?
コントリビューションガイド
評価
この issue はまだ評価されていません。