UNPKG
@lg-tools/crawler
Version:
latest (0.0.2)
0.0.2
0.0.1
0.0.0
Crawler for MongoDB documentation and other sites
@lg-tools/crawler
/
src
/
utils
/
newURL.ts
11 lines
(9 loc)
•
213 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
import
chalk
from
'chalk'
;
export
const
newURL
= (
href
:
string
) => {
try
{
return
new
URL
(href); }
catch
(error) {
console
.
error
(chalk.
red
(
`Invalid URL:
${href}
`
), error); process.
exit
(
1
); } };