JSPM

  • Created
  • Published
  • Downloads 279
  • Score
    100M100P100Q89700F
  • License MIT

Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.

Package Exports

  • github-url-detection

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (github-url-detection) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

github-url-detection

Which GitHub page are you on? Is it an issue? Is it a list? Perfect for your WebExtension or userscript.

Battle-tested by and extracted from the Refined GitHub extension.

Install

npm install github-url-detection
import * as pageDetect from 'github-url-detection';
const pageDetect = require('github-url-detection');

Usage

if (pageDetect.isRepo()) {
    alert('You’re looking at a repo!')
}


if (pageDetect.isDiscussionList()) {
    alert('You’re looking at a issues and PRs list!')
}

In the source you can see the full list of detections and their matching URLs.

Most tests are URL-based but a handful of them are DOM-based.

License

MIT © Federico Brigante