Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: replace url module with URL constructor in parseURL function
  • Loading branch information
Auwalms committed Aug 25, 2026
commit b313fda1a1245f40d5199fc1a23b22140b72c60a
14 changes: 11 additions & 3 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import chalk from 'chalk';
import readlineSync from 'readline-sync';
import url from 'url';
import APIs from './paystack/apis.js';
import axios from 'axios';
import progressBar from 'progressbar';
Expand Down Expand Up @@ -52,8 +51,17 @@ export function infoLog(error) {
}

export function parseURL(uri) {
if (!uri.startsWith('http')) uri = 'http://' + uri;
return url.parse(uri);
if (!uri.startsWith('http://') && !uri.startsWith('https://')) {
uri = 'http://' + uri;
}
const parsed = new URL(uri);
return {
protocol: parsed.protocol,
hostname: parsed.hostname,
port: parsed.port || '',
pathname: parsed.pathname,
search: parsed.search,
};
}

export function findSchema(command, args) {
Expand Down
131 changes: 0 additions & 131 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"progressbar": "^1.3.0",
"readline-sync": "^1.4.10",
"shelljs": "^0.8.5",
"url": "^0.11.0",
"vorpal": "^1.12.0"
},
"overrides": {
Expand Down