Style tweaks

This commit is contained in:
Michael Jackson
2018-04-04 12:06:17 -07:00
parent 2568de0467
commit 577fa7608b
4 changed files with 32 additions and 26 deletions

View File

@ -1,7 +1,8 @@
const url = require("url");
const isValidPackageName = require("./isValidPackageName");
const URLFormat = /^\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(\/.*)?$/;
const packageURLFormat = /^\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(\/.*)?$/;
function decodeParam(param) {
if (param) {
@ -18,7 +19,7 @@ function decodeParam(param) {
function parsePackageURL(originalURL) {
const { pathname, search, query } = url.parse(originalURL, true);
const match = URLFormat.exec(pathname);
const match = packageURLFormat.exec(pathname);
// Disallow invalid URL formats.
if (match == null) {