From fef96bb044c371a3a22cdef92b964e42eacd638b Mon Sep 17 00:00:00 2001 From: Monil Patel Date: Tue, 21 Nov 2023 15:58:18 -0800 Subject: [PATCH] add comments --- src/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.js b/src/index.js index f448233..adab6c4 100644 --- a/src/index.js +++ b/src/index.js @@ -36,7 +36,13 @@ import parsePath from "parse-path"; const parseUrl = (url, normalize = false) => { // Constants + /** + * ([a-z_][a-z0-9_-]{0,31}) Try to match the user + * ([\w\.\-@]+) Match the host/resource + * (([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?) Match the path, allowing spaces/white + */ const GIT_RE = /^(?:([a-z_][a-z0-9_-]{0,31})@|https?:\/\/)([\w\.\-@]+)[\/:](([\~,\.\w,\-,\_,\/,\s]|%[0-9A-Fa-f]{2})+?(?:\.git|\/)?)$/; + const throwErr = msg => { const err = new Error(msg) err.subject_url = url