Skip to content

Commit

Permalink
Minor reorg. Tweak.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlissner committed Nov 17, 2017
1 parent 9b4df30 commit 623e208
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions pacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,6 @@ let PACER = {
return !!url.match(/\/(DktRpt|HistDocQry)\.pl\?\d+$/);
},

// Given a URL that satisfies isDocketQueryUrl, gets its case number.
getCaseNumberFromUrls: function (urls) {
// Iterate over an array of URLs and get the case number from the first one
// that matches. Allows calling function to send a variety of URLs, like the
// referer and the actual URL, for example.
for (let url of urls){
let hostname = getHostname(url);
// JS is trash. It lacks a way of getting the TLD, so we use endsWith.
if (hostname.endsWith('uscourts.gov')){
let match = url.match(/\?(\d+)$/);
if (match){
return match[1];
}
}
}
},

// Returns true if the given URL is for a docket display page (i.e. the page
// after submitting the "Docket Sheet" or "History/Documents" query page).
isDocketDisplayUrl: function (url) {
Expand Down Expand Up @@ -118,6 +101,23 @@ let PACER = {
}
},

// Given a URL that satisfies isDocketQueryUrl, gets its case number.
getCaseNumberFromUrls: function (urls) {
// Iterate over an array of URLs and get the case number from the first one
// that matches. Allows calling function to send a variety of URLs, like the
// referer and the actual URL, for example.
for (let url of urls) {
let hostname = getHostname(url);
// JS is trash. It lacks a way of getting the TLD, so we use endsWith.
if (hostname.endsWith('uscourts.gov')) {
let match = url.match(/\?(\d+)$/);
if (match) {
return match[1];
}
}
}
},

// Gets the last path component of a URL.
getBaseNameFromUrl: function (url) {
return url.replace(/\?.*/, '').replace(/.*\//, '');
Expand Down

0 comments on commit 623e208

Please sign in to comment.