Gathering detailed insights and metrics for parse-github-url
Gathering detailed insights and metrics for parse-github-url
Parse a Github URL into an object. Supports a wide variety of GitHub URL formats.
npm install parse-github-url
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.6
Supply Chain
100
Quality
81.6
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
257,296,790
Last Day
246,534
Last Week
1,295,955
Last Month
5,543,733
Last Year
68,614,695
MIT License
122 Stars
54 Commits
21 Forks
6 Watchers
2 Branches
12 Contributors
Updated on Feb 11, 2025
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
parse-github-url@1.0.3
Unpacked Size
26.04 kB
Size
5.16 kB
File Count
5
NPM Version
10.8.1
Node Version
22.3.0
Published on
Jun 26, 2024
Cumulative downloads
Total Downloads
Last Day
7.9%
246,534
Compared to previous day
Last Week
2.3%
1,295,955
Compared to previous week
Last Month
32.2%
5,543,733
Compared to previous month
Last Year
5.5%
68,614,695
Compared to previous year
5
Parse a github URL into an object.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm:
1$ npm install --save parse-github-url
Why another GitHub URL parser library?
Seems like every lib I've found does too much, like both stringifying and parsing, or converts the URL from one format to another, only returns certain segments of the URL except for what I need, yields inconsistent results or has poor coverage.
1var gh = require('parse-github-url'); 2gh('https://github.com/jonschlinkert/micromatch');
Results in:
1{ 2 "owner": "jonschlinkert", 3 "name": "micromatch", 4 "repo": "jonschlinkert/micromatch", 5 "branch": "master" 6}
Generated results from test fixtures:
1// assemble/verb#1.2.3 2Url { 3 protocol: null, 4 slashes: null, 5 auth: null, 6 host: 'github.com', 7 port: null, 8 hostname: null, 9 hash: '#1.2.3', 10 search: null, 11 query: null, 12 pathname: 'assemble/verb', 13 path: 'assemble/verb', 14 href: 'assemble/verb#1.2.3', 15 filepath: null, 16 owner: 'assemble', 17 name: 'verb', 18 repo: 'assemble/verb', 19 branch: '1.2.3', 20 repository: 'assemble/verb' } 21 22// assemble/verb#branch 23Url { 24 protocol: null, 25 slashes: null, 26 auth: null, 27 host: 'github.com', 28 port: null, 29 hostname: null, 30 hash: '#branch', 31 search: null, 32 query: null, 33 pathname: 'assemble/verb', 34 path: 'assemble/verb', 35 href: 'assemble/verb#branch', 36 filepath: null, 37 owner: 'assemble', 38 name: 'verb', 39 repo: 'assemble/verb', 40 branch: 'branch', 41 repository: 'assemble/verb' } 42 43// assemble/verb 44Url { 45 protocol: null, 46 slashes: null, 47 auth: null, 48 host: 'github.com', 49 port: null, 50 hostname: null, 51 hash: null, 52 search: null, 53 query: null, 54 pathname: 'assemble/verb', 55 path: 'assemble/verb', 56 href: 'assemble/verb', 57 filepath: null, 58 owner: 'assemble', 59 name: 'verb', 60 repo: 'assemble/verb', 61 branch: 'master', 62 repository: 'assemble/verb' } 63 64// git+https://github.com/assemble/verb.git 65Url { 66 protocol: 'git+https:', 67 slashes: true, 68 auth: null, 69 host: 'github.com', 70 port: null, 71 hostname: 'github.com', 72 hash: null, 73 search: null, 74 query: null, 75 pathname: 'assemble/verb.git', 76 path: 'assemble/verb.git', 77 href: 'git+https://github.com/assemble/verb.git', 78 filepath: null, 79 owner: 'assemble', 80 name: 'verb', 81 repo: 'assemble/verb', 82 branch: 'master', 83 repository: 'assemble/verb' } 84 85// git+ssh://github.com/assemble/verb.git 86Url { 87 protocol: 'git+ssh:', 88 slashes: true, 89 auth: null, 90 host: 'github.com', 91 port: null, 92 hostname: 'github.com', 93 hash: null, 94 search: null, 95 query: null, 96 pathname: 'assemble/verb.git', 97 path: 'assemble/verb.git', 98 href: 'git+ssh://github.com/assemble/verb.git', 99 filepath: null, 100 owner: 'assemble', 101 name: 'verb', 102 repo: 'assemble/verb', 103 branch: 'master', 104 repository: 'assemble/verb' } 105 106// git://gh.pages.com/assemble/verb.git 107Url { 108 protocol: 'git:', 109 slashes: true, 110 auth: null, 111 host: 'gh.pages.com', 112 port: null, 113 hostname: 'gh.pages.com', 114 hash: null, 115 search: null, 116 query: null, 117 pathname: 'assemble/verb.git', 118 path: 'assemble/verb.git', 119 href: 'git://gh.pages.com/assemble/verb.git', 120 filepath: null, 121 owner: 'assemble', 122 name: 'verb', 123 repo: 'assemble/verb', 124 branch: 'master', 125 repository: 'assemble/verb' } 126 127// git://github.assemble.com/assemble/verb.git 128Url { 129 protocol: 'git:', 130 slashes: true, 131 auth: null, 132 host: 'github.assemble.com', 133 port: null, 134 hostname: 'github.assemble.com', 135 hash: null, 136 search: null, 137 query: null, 138 pathname: 'assemble/verb.git', 139 path: 'assemble/verb.git', 140 href: 'git://github.assemble.com/assemble/verb.git', 141 filepath: null, 142 owner: 'assemble', 143 name: 'verb', 144 repo: 'assemble/verb', 145 branch: 'master', 146 repository: 'assemble/verb' } 147 148// git://github.assemble.two.com/assemble/verb.git 149Url { 150 protocol: 'git:', 151 slashes: true, 152 auth: null, 153 host: 'github.assemble.two.com', 154 port: null, 155 hostname: 'github.assemble.two.com', 156 hash: null, 157 search: null, 158 query: null, 159 pathname: 'assemble/verb.git', 160 path: 'assemble/verb.git', 161 href: 'git://github.assemble.two.com/assemble/verb.git', 162 filepath: null, 163 owner: 'assemble', 164 name: 'verb', 165 repo: 'assemble/verb', 166 branch: 'master', 167 repository: 'assemble/verb' } 168 169// git://github.com/assemble/verb 170Url { 171 protocol: 'git:', 172 slashes: true, 173 auth: null, 174 host: 'github.com', 175 port: null, 176 hostname: 'github.com', 177 hash: null, 178 search: null, 179 query: null, 180 pathname: 'assemble/verb', 181 path: 'assemble/verb', 182 href: 'git://github.com/assemble/verb', 183 filepath: null, 184 owner: 'assemble', 185 name: 'verb', 186 repo: 'assemble/verb', 187 branch: 'master', 188 repository: 'assemble/verb' } 189 190// git://github.com/assemble/verb.git 191Url { 192 protocol: 'git:', 193 slashes: true, 194 auth: null, 195 host: 'github.com', 196 port: null, 197 hostname: 'github.com', 198 hash: null, 199 search: null, 200 query: null, 201 pathname: 'assemble/verb.git', 202 path: 'assemble/verb.git', 203 href: 'git://github.com/assemble/verb.git', 204 filepath: null, 205 owner: 'assemble', 206 name: 'verb', 207 repo: 'assemble/verb', 208 branch: 'master', 209 repository: 'assemble/verb' } 210 211// git@gh.pages.com:assemble/verb.git 212Url { 213 protocol: null, 214 slashes: null, 215 auth: null, 216 host: 'gh.pages.com', 217 port: null, 218 hostname: null, 219 hash: null, 220 search: null, 221 query: null, 222 pathname: 'git@gh.pages.com:assemble/verb.git', 223 path: 'git@gh.pages.com:assemble/verb.git', 224 href: 'git@gh.pages.com:assemble/verb.git', 225 filepath: null, 226 owner: 'assemble', 227 name: 'verb', 228 repo: 'assemble/verb', 229 branch: 'master', 230 repository: 'assemble/verb' } 231 232// git@github.com:assemble/verb.git#1.2.3 233Url { 234 protocol: null, 235 slashes: null, 236 auth: null, 237 host: 'github.com', 238 port: null, 239 hostname: null, 240 hash: '#1.2.3', 241 search: null, 242 query: null, 243 pathname: 'git@github.com:assemble/verb.git', 244 path: 'git@github.com:assemble/verb.git', 245 href: 'git@github.com:assemble/verb.git#1.2.3', 246 filepath: null, 247 owner: 'assemble', 248 name: 'verb', 249 repo: 'assemble/verb', 250 branch: '1.2.3', 251 repository: 'assemble/verb' } 252 253// git@github.com:assemble/verb.git#v1.2.3 254Url { 255 protocol: null, 256 slashes: null, 257 auth: null, 258 host: 'github.com', 259 port: null, 260 hostname: null, 261 hash: '#v1.2.3', 262 search: null, 263 query: null, 264 pathname: 'git@github.com:assemble/verb.git', 265 path: 'git@github.com:assemble/verb.git', 266 href: 'git@github.com:assemble/verb.git#v1.2.3', 267 filepath: null, 268 owner: 'assemble', 269 name: 'verb', 270 repo: 'assemble/verb', 271 branch: 'v1.2.3', 272 repository: 'assemble/verb' } 273 274// git@github.com:assemble/verb.git 275Url { 276 protocol: null, 277 slashes: null, 278 auth: null, 279 host: 'github.com', 280 port: null, 281 hostname: null, 282 hash: null, 283 search: null, 284 query: null, 285 pathname: 'git@github.com:assemble/verb.git', 286 path: 'git@github.com:assemble/verb.git', 287 href: 'git@github.com:assemble/verb.git', 288 filepath: null, 289 owner: 'assemble', 290 name: 'verb', 291 repo: 'assemble/verb', 292 branch: 'master', 293 repository: 'assemble/verb' } 294 295// github:assemble/verb 296Url { 297 protocol: 'github:', 298 slashes: null, 299 auth: null, 300 host: 'assemble', 301 port: null, 302 hostname: 'assemble', 303 hash: null, 304 search: null, 305 query: null, 306 pathname: 'verb', 307 path: 'verb', 308 href: 'github:assemble/verb', 309 filepath: null, 310 owner: 'assemble', 311 name: 'verb', 312 repo: 'assemble/verb', 313 branch: 'master', 314 repository: 'assemble/verb' } 315 316// http://github.com/assemble 317Url { 318 protocol: 'http:', 319 slashes: true, 320 auth: null, 321 host: 'github.com', 322 port: null, 323 hostname: 'github.com', 324 hash: null, 325 search: null, 326 query: null, 327 pathname: 'assemble', 328 path: 'assemble', 329 href: 'http://github.com/assemble', 330 filepath: null, 331 owner: 'assemble', 332 name: null, 333 repo: null, 334 branch: 'master', 335 repository: null } 336 337// http://github.com/assemble/verb 338Url { 339 protocol: 'http:', 340 slashes: true, 341 auth: null, 342 host: 'github.com', 343 port: null, 344 hostname: 'github.com', 345 hash: null, 346 search: null, 347 query: null, 348 pathname: 'assemble/verb', 349 path: 'assemble/verb', 350 href: 'http://github.com/assemble/verb', 351 filepath: null, 352 owner: 'assemble', 353 name: 'verb', 354 repo: 'assemble/verb', 355 branch: 'master', 356 repository: 'assemble/verb' } 357 358// http://github.com/assemble/verb.git 359Url { 360 protocol: 'http:', 361 slashes: true, 362 auth: null, 363 host: 'github.com', 364 port: null, 365 hostname: 'github.com', 366 hash: null, 367 search: null, 368 query: null, 369 pathname: 'assemble/verb.git', 370 path: 'assemble/verb.git', 371 href: 'http://github.com/assemble/verb.git', 372 filepath: null, 373 owner: 'assemble', 374 name: 'verb', 375 repo: 'assemble/verb', 376 branch: 'master', 377 repository: 'assemble/verb' } 378 379// http://github.com/assemble/verb/tree 380Url { 381 protocol: 'http:', 382 slashes: true, 383 auth: null, 384 host: 'github.com', 385 port: null, 386 hostname: 'github.com', 387 hash: null, 388 search: null, 389 query: null, 390 pathname: 'assemble/verb/tree', 391 path: 'assemble/verb/tree', 392 href: 'http://github.com/assemble/verb/tree', 393 filepath: null, 394 branch: 'tree', 395 owner: 'assemble', 396 name: 'verb', 397 repo: 'assemble/verb', 398 repository: 'assemble/verb' } 399 400// http://github.com/assemble/verb/tree/master 401Url { 402 protocol: 'http:', 403 slashes: true, 404 auth: null, 405 host: 'github.com', 406 port: null, 407 hostname: 'github.com', 408 hash: null, 409 search: null, 410 query: null, 411 pathname: 'assemble/verb/tree/master', 412 path: 'assemble/verb/tree/master', 413 href: 'http://github.com/assemble/verb/tree/master', 414 filepath: null, 415 branch: 'master', 416 owner: 'assemble', 417 name: 'verb', 418 repo: 'assemble/verb', 419 repository: 'assemble/verb' } 420 421// http://github.com/assemble/verb/tree/master/foo/bar 422Url { 423 protocol: 'http:', 424 slashes: true, 425 auth: null, 426 host: 'github.com', 427 port: null, 428 hostname: 'github.com', 429 hash: null, 430 search: null, 431 query: null, 432 pathname: 'assemble/verb/tree/master/foo/bar', 433 path: 'assemble/verb/tree/master/foo/bar', 434 href: 'http://github.com/assemble/verb/tree/master/foo/bar', 435 filepath: null, 436 branch: 'master', 437 owner: 'assemble', 438 name: 'verb', 439 repo: 'assemble/verb', 440 repository: 'assemble/verb' } 441 442// https://assemble.github.com/assemble/verb/somefile.tar.gz 443Url { 444 protocol: 'https:', 445 slashes: true, 446 auth: null, 447 host: 'assemble.github.com', 448 port: null, 449 hostname: 'assemble.github.com', 450 hash: null, 451 search: null, 452 query: null, 453 pathname: 'assemble/verb/somefile.tar.gz', 454 path: 'assemble/verb/somefile.tar.gz', 455 href: 'https://assemble.github.com/assemble/verb/somefile.tar.gz', 456 filepath: null, 457 owner: 'assemble', 458 name: 'verb', 459 repo: 'assemble/verb', 460 branch: 'somefile.tar.gz', 461 repository: 'assemble/verb' } 462 463// https://assemble.github.com/assemble/verb/somefile.zip 464Url { 465 protocol: 'https:', 466 slashes: true, 467 auth: null, 468 host: 'assemble.github.com', 469 port: null, 470 hostname: 'assemble.github.com', 471 hash: null, 472 search: null, 473 query: null, 474 pathname: 'assemble/verb/somefile.zip', 475 path: 'assemble/verb/somefile.zip', 476 href: 'https://assemble.github.com/assemble/verb/somefile.zip', 477 filepath: null, 478 owner: 'assemble', 479 name: 'verb', 480 repo: 'assemble/verb', 481 branch: 'somefile.zip', 482 repository: 'assemble/verb' } 483 484// https://assemble@github.com/assemble/verb.git 485Url { 486 protocol: 'https:', 487 slashes: true, 488 auth: 'assemble', 489 host: 'github.com', 490 port: null, 491 hostname: 'github.com', 492 hash: null, 493 search: null, 494 query: null, 495 pathname: 'assemble/verb.git', 496 path: 'assemble/verb.git', 497 href: 'https://assemble@github.com/assemble/verb.git', 498 filepath: null, 499 owner: 'assemble', 500 name: 'verb', 501 repo: 'assemble/verb', 502 branch: 'master', 503 repository: 'assemble/verb' } 504 505// https://gh.pages.com/assemble/verb.git 506Url { 507 protocol: 'https:', 508 slashes: true, 509 auth: null, 510 host: 'gh.pages.com', 511 port: null, 512 hostname: 'gh.pages.com', 513 hash: null, 514 search: null, 515 query: null, 516 pathname: 'assemble/verb.git', 517 path: 'assemble/verb.git', 518 href: 'https://gh.pages.com/assemble/verb.git', 519 filepath: null, 520 owner: 'assemble', 521 name: 'verb', 522 repo: 'assemble/verb', 523 branch: 'master', 524 repository: 'assemble/verb' } 525 526// https://github.com/assemble/verb 527Url { 528 protocol: 'https:', 529 slashes: true, 530 auth: null, 531 host: 'github.com', 532 port: null, 533 hostname: 'github.com', 534 hash: null, 535 search: null, 536 query: null, 537 pathname: 'assemble/verb', 538 path: 'assemble/verb', 539 href: 'https://github.com/assemble/verb', 540 filepath: null, 541 owner: 'assemble', 542 name: 'verb', 543 repo: 'assemble/verb', 544 branch: 'master', 545 repository: 'assemble/verb' } 546 547// https://github.com/assemble/verb.git 548Url { 549 protocol: 'https:', 550 slashes: true, 551 auth: null, 552 host: 'github.com', 553 port: null, 554 hostname: 'github.com', 555 hash: null, 556 search: null, 557 query: null, 558 pathname: 'assemble/verb.git', 559 path: 'assemble/verb.git', 560 href: 'https://github.com/assemble/verb.git', 561 filepath: null, 562 owner: 'assemble', 563 name: 'verb', 564 repo: 'assemble/verb', 565 branch: 'master', 566 repository: 'assemble/verb' } 567 568// https://github.com/assemble/verb/blob/1.2.3/README.md 569Url { 570 protocol: 'https:', 571 slashes: true, 572 auth: null, 573 host: 'github.com', 574 port: null, 575 hostname: 'github.com', 576 hash: null, 577 search: null, 578 query: null, 579 pathname: 'assemble/verb/blob/1.2.3/README.md', 580 path: 'assemble/verb/blob/1.2.3/README.md', 581 href: 'https://github.com/assemble/verb/blob/1.2.3/README.md', 582 filepath: 'README.md', 583 branch: '1.2.3', 584 blob: '1.2.3/README.md', 585 owner: 'assemble', 586 name: 'verb', 587 repo: 'assemble/verb', 588 repository: 'assemble/verb' } 589 590// https://github.com/assemble/verb/blob/249b21a86400b38969cee3d5df6d2edf8813c137/README.md 591Url { 592 protocol: 'https:', 593 slashes: true, 594 auth: null, 595 host: 'github.com', 596 port: null, 597 hostname: 'github.com', 598 hash: null, 599 search: null, 600 query: null, 601 pathname: 'assemble/verb/blob/249b21a86400b38969cee3d5df6d2edf8813c137/README.md', 602 path: 'assemble/verb/blob/249b21a86400b38969cee3d5df6d2edf8813c137/README.md', 603 href: 'https://github.com/assemble/verb/blob/249b21a86400b38969cee3d5df6d2edf8813c137/README.md', 604 filepath: '249b21a86400b38969cee3d5df6d2edf8813c137/README.md', 605 blob: '249b21a86400b38969cee3d5df6d2edf8813c137/README.md', 606 owner: 'assemble', 607 name: 'verb', 608 repo: 'assemble/verb', 609 branch: 'blob', 610 repository: 'assemble/verb' } 611 612// https://github.com/assemble/verb/blob/master/assemble/index.js 613Url { 614 protocol: 'https:', 615 slashes: true, 616 auth: null, 617 host: 'github.com', 618 port: null, 619 hostname: 'github.com', 620 hash: null, 621 search: null, 622 query: null, 623 pathname: 'assemble/verb/blob/master/assemble/index.js', 624 path: 'assemble/verb/blob/master/assemble/index.js', 625 href: 'https://github.com/assemble/verb/blob/master/assemble/index.js', 626 filepath: 'assemble/index.js', 627 branch: 'master', 628 blob: 'master/assemble/index.js', 629 owner: 'assemble', 630 name: 'verb', 631 repo: 'assemble/verb', 632 repository: 'assemble/verb' } 633 634// https://github.com/assemble/verb/tree/1.2.3 635Url { 636 protocol: 'https:', 637 slashes: true, 638 auth: null, 639 host: 'github.com', 640 port: null, 641 hostname: 'github.com', 642 hash: null, 643 search: null, 644 query: null, 645 pathname: 'assemble/verb/tree/1.2.3', 646 path: 'assemble/verb/tree/1.2.3', 647 href: 'https://github.com/assemble/verb/tree/1.2.3', 648 filepath: null, 649 branch: '1.2.3', 650 owner: 'assemble', 651 name: 'verb', 652 repo: 'assemble/verb', 653 repository: 'assemble/verb' } 654 655// https://github.com/assemble/verb/tree/feature/1.2.3 656Url { 657 protocol: 'https:', 658 slashes: true, 659 auth: null, 660 host: 'github.com', 661 port: null, 662 hostname: 'github.com', 663 hash: null, 664 search: null, 665 query: null, 666 pathname: 'assemble/verb/tree/feature/1.2.3', 667 path: 'assemble/verb/tree/feature/1.2.3', 668 href: 'https://github.com/assemble/verb/tree/feature/1.2.3', 669 filepath: null, 670 branch: 'feature', 671 owner: 'assemble', 672 name: 'verb', 673 repo: 'assemble/verb', 674 repository: 'assemble/verb' } 675 676// https://github.com/repos/assemble/verb/tarball 677Url { 678 protocol: 'https:', 679 slashes: true, 680 auth: null, 681 host: 'github.com', 682 port: null, 683 hostname: 'github.com', 684 hash: null, 685 search: null, 686 query: null, 687 pathname: 'repos/assemble/verb/tarball', 688 path: 'assemble/verb/tarball', 689 href: 'https://github.com/repos/assemble/verb/tarball', 690 filepath: null, 691 owner: 'assemble', 692 name: 'verb', 693 repo: 'assemble/verb', 694 branch: 'tarball', 695 repository: 'assemble/verb' } 696 697// https://github.com/repos/assemble/verb/zipball 698Url { 699 protocol: 'https:', 700 slashes: true, 701 auth: null, 702 host: 'github.com', 703 port: null, 704 hostname: 'github.com', 705 hash: null, 706 search: null, 707 query: null, 708 pathname: 'repos/assemble/verb/zipball', 709 path: 'assemble/verb/zipball', 710 href: 'https://github.com/repos/assemble/verb/zipball', 711 filepath: null, 712 owner: 'assemble', 713 name: 'verb', 714 repo: 'assemble/verb', 715 branch: 'zipball', 716 repository: 'assemble/verb' }
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
1$ npm install && npm test
You might also be interested in these projects:
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 6/26 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-10
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 More