✌ A high level git url parser for common git providers.
Installations
npm install git-url-parse
Score
99.8
Supply Chain
100
Quality
84.1
Maintenance
100
Vulnerability
100
License
Developer
IonicaBizau
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
22.10.0
NPM Version
10.9.0
Statistics
183 Stars
286 Commits
46 Forks
6 Watching
2 Branches
24 Contributors
Updated on 17 Nov 2024
Bundle Size
10.70 kB
Minified
4.03 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
657,083,218
Last day
1.2%
775,611
Compared to previous day
Last week
6%
4,208,832
Compared to previous week
Last month
22.7%
16,985,223
Compared to previous month
Last year
13.2%
168,892,458
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
git-url-parse
A high level git url parser for common git providers.
:cloud: Installation
1# Using npm 2npm install --save git-url-parse 3 4# Using yarn 5yarn add git-url-parse
:clipboard: Example
1// Dependencies 2const GitUrlParse = require("git-url-parse"); 3 4console.log(GitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git")); 5// => { 6// protocols: [] 7// , port: null 8// , resource: "github.com" 9// , user: "git" 10// , pathname: "/IonicaBizau/node-git-url-parse.git" 11// , hash: "" 12// , search: "" 13// , href: "git@github.com:IonicaBizau/node-git-url-parse.git" 14// , token: "" 15// , protocol: "ssh" 16// , toString: [Function] 17// , source: "github.com" 18// , name: "node-git-url-parse" 19// , owner: "IonicaBizau" 20// } 21 22console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git")); 23// => { 24// protocols: ["https"] 25// , port: null 26// , resource: "github.com" 27// , user: "" 28// , pathname: "/IonicaBizau/node-git-url-parse.git" 29// , hash: "" 30// , search: "" 31// , href: "https://github.com/IonicaBizau/node-git-url-parse.git" 32// , token: "" 33// , protocol: "https" 34// , toString: [Function] 35// , source: "github.com" 36// , name: "node-git-url-parse" 37// , owner: "IonicaBizau" 38// } 39 40console.log(GitUrlParse("https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js")); 41// { protocols: [ 'https' ], 42// protocol: 'https', 43// port: null, 44// resource: 'github.com', 45// user: '', 46// pathname: '/IonicaBizau/git-url-parse/blob/master/test/index.js', 47// hash: '', 48// search: '', 49// href: 'https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js', 50// token: '', 51// toString: [Function], 52// source: 'github.com', 53// name: 'git-url-parse', 54// owner: 'IonicaBizau', 55// organization: '', 56// ref: 'master', 57// filepathtype: 'blob', 58// filepath: 'test/index.js', 59// full_name: 'IonicaBizau/git-url-parse' } 60 61console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git").toString("ssh")); 62// => "git@github.com:IonicaBizau/node-git-url-parse.git" 63 64console.log(GitUrlParse("git@github.com:IonicaBizau/node-git-url-parse.git").toString("https")); 65// => "https://github.com/IonicaBizau/node-git-url-parse.git"
:question: Get Help
There are few ways to get help:
- Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
- For bug reports and feature requests, open issues. :bug:
- For direct and quick help, you can use Codementor. :rocket:
:memo: Documentation
gitUrlParse(url, refs)
Parses a Git url.
Params
- String
url
: The Git url to parse. - Array
refs
: An array of strings representing the refs. This is helpful in the context of the URLs that contain branches with slashes. If user wants to identify the branch, he should pass all branch names of the project as part of refs parameter
Return
- GitUrl The
GitUrl
object containing: protocols
(Array): An array with the url protocols (usually it has one element).port
(null|Number): The domain port.resource
(String): The url domain (including subdomains).user
(String): The authentication user (usually for ssh urls).pathname
(String): The url pathname.hash
(String): The url hash.search
(String): The url querystring value.href
(String): The input url.protocol
(String): The git url protocol.token
(String): The oauth token (could appear in the https urls).source
(String): The Git provider (e.g."github.com"
).owner
(String): The repository owner.name
(String): The repository name.ref
(String): The repository ref (e.g., "master" or "dev").filepath
(String): A filepath relative to the repository root.filepathtype
(String): The type of filepath in the url ("blob" or "tree").full_name
(String): The owner and name values in theowner/name
format.toString
(Function): A function to stringify the parsed url into another url type.organization
(String): The organization the owner belongs to. This is CloudForge specific.git_suffix
(Boolean): Whether to add the.git
suffix or not.
stringify(obj, type)
Stringifies a GitUrl
object.
Params
- GitUrl
obj
: The parsed Git url object. - String
type
: The type of the stringified url (defaultobj.protocol
).
Return
- String The stringified url.
:yum: How to contribute
Have an idea? Found a bug? See how to contribute.
:sparkling_heart: Support my projects
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
-
Starring and sharing the projects you like :rocket:
-
—I love books! I will remember you after years if you buy me one. :grin: :book:
-
—You can make one-time donations via PayPal. I'll probably buy a
coffeetea. :tea: -
—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).
-
Bitcoin—You can send me bitcoins at this address (or scanning the code below):
1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6
Thanks! :heart:
:dizzy: Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles:
@0x-lerna-fork/github-client
@1coin178/github-compare
@_nomtek/react-native-shimmer-animation
@adityasinghal26/backstage-plugin-daytona
@akemona-org/strapi-generate-new
@amiruldev/wajs
@anakz/backstage-plugin-library-check-backend
@antv/gatsby-theme-antv
@appirio/appirio
@appworks/project-utils
@arcanis/sherlock
@ashcorrguardian/cdk
@atomist/automation-client
@atomist/automation-client-ext-raven
@atomist/cli
@atomist/sdm-pack-analysis
@atomist/skill
@atomist/uhura
@axetroy/gpm
@backstage-community/plugin-github-actions
@backstage/backend-common
@backstage/backend-defaults
@backstage/cli
@backstage/integration
@backstage/plugin-catalog-backend
@backstage/plugin-catalog-backend-module-github
@backstage/plugin-catalog-import
@backstage/plugin-github-actions
@backstage/plugin-scaffolder
@backstage/plugin-scaffolder-backend-module-confluence-to-markdown
@backstage/plugin-techdocs
@backstage/plugin-techdocs-module-addons-contrib
@backstage/plugin-techdocs-node
@belt/repo
@blackglory/git-list
@brainfried/github-books
@brantalikp/rn-resize
@brisk-docs/gatsby-generator
@brisk-docs/website
@buschtoens/documentation
@cilyn/bitbucket
@ckatzorke/renovate
@cliz/gpm
@codemod.com/workflow
@corelmax/react-native-my2c2p-sdk
@cs6/react-native-test-native-view-library
@csmith/release-it
@ctdesarrollo/pack-up
@dandean/storybook-deployer
@daytona-io/backstage-plugin-daytona
@deskbtm/workspace-tools
@dfatwork-pkgs/backstage-cli
@dougkulak/semantic-release-gh-pages-plugin
@dtwo/telemetry
@eat-fish/changelog
@emedvedev/renovate
@enkeledi/react-native-week-month-date-picker
@era-ci/utils
@erquhart/lerna-github-client
@esops/publish-github-pages
@eteg/nextra-theme-docs
@evanpurkhiser/tooling-personal
@facadecompany/ignition-ui
@feizheng/next-git-url
@felipesimmi/react-native-datalogic-module
@flxbl-io/sfp
@focusworkstemp/project-utils
@form8ion/lift
@gasket/plugin-metrics
@geut/chan-parser
@geut/git-compare-template
@geut/git-url-parse
@git-stack/hemera-plugin
@git-stack/server-core
@guardian/cdk
@hawkingnetwork/react-native-tab-view
@hbglobal/react-native-actions-shortcuts
@hemith/react-native-tnk
@hugomrdias/documentation
@hygiene/plugin-github-url
@iceworks/project-utils
@infinitecsolutions/storybook-deployer
@janus-idp/backstage-plugin-topology
@jaredpalmer/workspace-tools
@jswork/next-git-url
@jswork/topics2keywords
@kadira/storybook-deployer
@kevinbds/techdocs-common
@kgit/readability
@kgit/readbility
@koumoul/gh-pages-multi
@labiebhn_/react-native-multiplier
@lacymorrow/nextra-theme-docs
@lehuyaa/my-assets
@lerna-lite/version
@lerna-test-v1/markdown
@lerna/create
@lerna/github-client
@lerna/legacy-package-management
@log4brains/core
@madm4ttus3r/l4bcore
@merna/github-client
@micro-app/shared-utils
@microservices/cli
@mmomtchev/documentation
@mongchhi/plugin-blocks
@monokle/synchronizer
@narfeta/catalog-backend
@navabi/react-native-ssl-pinning
@nuxt/telemetry
@nuxt/ui-pro
@nuxthq/studio
@oiti/rn-liveness2d
@oumi/block-sdk
@oumi/cli-ui
@pageshare/cli
@parallelnft/web3modal
@pipelinedoc/cli
@plone/scripts
@pmworks/project-utils
@positionex/position-sdk
@praella/localisationist
@pubbo/github-client
@pubgcorp/semantic-release-gitlabmonorepo
@pvdlg/semantic-release
@pvm/core
@qiwi/semantic-release-gh-pages-plugin
@qoopido/lerna.version
@radjs/block-sdk
@rdfrontier/plugin-mobile
@react-18-pdf/root
@rianfowler/backstage-backend-common
@rnx-kit/build
@roadiehq/backstage-plugin-github-insights
@rocali/apollo
@s-ui/mono
@s-ui/ssr
@s-ui/studio
@safaricom/strapi
@safely-project/safely-ts
@salla.sa/cli
@sanity/pkg-utils
@sanv/apify-shared
@scafflater/scafflater
@secustor/backstage-plugin-renovate-common
@servable/manifest
@servable/tools
@shopgate/pwa-releaser
@speakeasy-sdks/nextra-theme-docs
@spotify/backstage-plugin-soundcheck-backend-module-gitlab
@spryker-lerna/github-client
@sridharetikala/react-native-rn-lib-custom-components
@ssaitho/nextra-theme-docs
@sse-ui/nuxt
@stackbit/cms-git
@stackbit/dev-common
@status-im/react-native-transparent-video
@stepsec/release
@storybook/storybook-deployer
@strapi/pack-up
@strapi/sdk-plugin
@strapi/strapi
@tahul/ui-fix
@taingo97/react-native-sunmi-printer
@taingo97/react-native-telpo-printer
@takagiy/create-ts-starter
@tasenor/common-node
@theowenyoung/gatsby-source-git
@tmplr/node
@toanz/strapi-generate-new
@umijs/block-sdk
@unibtc/release-it
@useoptic/optic
@vamsikc/plugin-catalog
@veecode-platform/plugin-github-actions
@visulima/nextra-theme-docs
@voodeng/uppacks
@vrabbi/plugin-scaffolder
@vrabbi/plugin-scaffolder-backend
@wetrial/block-sdk
@whhjdi/nextra-theme-docs
@wolfy1339/gatsby-source-git
@x-team/strapi-generate-new
@xdn/cli
@xyz/create-package
@yarnpkg/plugin-git
@zeplin/cli
anakketiga
anaklanangtea
anakwadontea
apify-shared
apollo
archlibrary
auto-changelog-vsts
autorelease-setup
belt-repo
biometric-st
bitbucket-pullr
changelog.md
checkbox-component
clipped
codesandbox-theme-docs
common-boilerplate
complan
copy-github-directory
cover-builder
create-apex-js-app
create-minimal-monorepo
cz-conventional-changelog-befe
datoit-generate-new
debone
def-core
development-efficiency
docula-ui
docula-ui-express
documentation
documentation-custom-markdown
dx-scanner
ewizard-cli
fluent.adflow.reactnativesdk-alpha
flutter-boot
fmsl
fotingo
framework_test_library_sixdee
fster
ftl-renovate
gatsby-source-git
gatsby-source-git-remotes
gatsby-source-npmjs
gatsby-theme-cone
gatsby-theme-nestx
gatsby-theme-zh
gaurav-react-native-loop
gcpayz-block-sdk
generate-github-directory
generator-openapi-repo
gerimismalamsenin
ghseek
git-issues
git-observer
git-origin-check
git-service-node
git-source
git-url-promise
git-yoink
gitbook-start-iaas-bbdd-alex-moi
gitbook-start-iaas-ull-es-merquililycony
gitbook-start-plugin-iaas-ull-es-noejaco2017
gitc
github-action-readme
github-publish-npm
gitlab-ci-variables-cli
gtni
harry-reporter
hzero-block-sdk
jrennsoh88-react-native-scroll-indicator
jsnix
kef-core
khaled-salem-custom-components
konfig-release-it
konitor
kuqoi-git
l-other-data
laborious
lambda-service
lcov-server
lerna
lime-cli
manage-dependency
mangudinlagirajin
mdnext-loader
miguelcostero-ng2-toasty
native-apple-login
native-kakao-login
nextra-theme-docs-mdxcomponents
ng-apollo
npm_one_1_2_3
npm_qwerty
octokit-downloader
omg
open-pull-request
package-health-checker
package-json-from-git
patchanon-cli
patepangdeui
pbc
pileuleuyantea
pr-changelog-gen
pree
prep-barv11
project-wajs-dv
publish-version
pupils-generate-new
pyreswap-sdk
qts-fission
quick-release
quinntainer
rdmobile
reablocks-docs-theme
react-native-android-native-view
react-native-android-video-player-view
react-native-animate-text
react-native-arunjeyam1987
react-native-arunmeena1987
react-native-awesome-module-dharmesh
react-native-awesome-module-two
react-native-azure-communication-services
react-native-basic-app
react-native-basic-screen
react-native-biometric-authenticate
react-native-bleccs-components
react-native-bubble-chart
react-native-build-vesion-getter
react-native-check-component
react-native-components-design
react-native-contact-list
react-native-cplus
react-native-create-video-thumbnail
react-native-custom-poccomponent
react-native-datacapture-core
react-native-dhp-printer
react-native-fedlight-dsm
react-native-flyy
react-native-ghn-ekyc
react-native-innity-remaster
react-native-input-library
react-native-is7
react-native-kakao-maps
react-native-klarify-ios
react-native-klc
react-native-library-testing-422522
react-native-login-demo-test
react-native-manh-test
react-native-module-for-testing
react-native-multiplier-component
react-native-multiplier-demo
react-native-multiplier2
react-native-multiselector
react-native-my-first-try-arun-ramya
react-native-nice-learning
react-native-paynow-generator
react-native-payu-payment-testing
react-native-progress-arrow
react-native-rabbitmq-all
react-native-reanimated-sortable-list
react-native-rom-components
react-native-s-airlines
react-native-sandycomponent
react-native-savczuk-feature-library
react-native-shared-gesture
react-native-test-comlibrary
react-native-ticker-tape
react-native-uvc-camera-android
react-native-withframework-check
react-native-ytximkit
redhatinsights-plugin-scaffolder-backend
refinejs-repo
release-it
release-it-http
remax-stats
renovate
renovate-csm
repom
rn-adyen-dropin
rn-check-btn
rn_unique_device_id
scaffolder-core
sedanbosok
semantic-release-github-milestones
semantic-release-gitmoji
semantic-release-squash3
sherry-utils
simple-github-release
snipx
spk
strapi-generate-new
stylelint-formatter-utils
sync-repos
tanyao
tegit
tehmusimhujan
template-typescript-node-package
test-library-123
testarmada-midway
tldw
todo2issue
tooling-personal
toxics-rpc
umi-build-dev
vision-camera-plugin-face-detector
vuepress-plugin-remote-url
wiby
winx-form-winx
workspace-tools
wsj.gatsby-source-git
:scroll: License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
Found 4/11 approved changesets -- score normalized to 3
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Score
4
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to git-url-parse
@types/git-url-parse
TypeScript definitions for git-url-parse
@geut/git-url-parse
Function to parse a git url and generates template url for the git compare preview.
@hutson/parse-repository-url
Parse repository URLs to extract, SCM platform, domain, user, and project information.
parse-url
An advanced url parser supporting git urls too.