This commit is contained in:
syuilo 2017-09-13 03:32:12 +09:00
parent f8953abefb
commit 1e10ab9b82
2 changed files with 8 additions and 2 deletions

View File

@ -91,8 +91,12 @@ export default async (url: URL.Url): Promise<Summary> => {
const toAbsolute = (relativeURLString: string): string => {
const relativeURL = URL.parse(relativeURLString);
const isAbsolute = relativeURL.slashes || relativeURL.path[0] === '/';
// 既に絶対的なら、即座に値を返却
if (isAbsolute) return relativeURLString;
if (isAbsolute) {
return relativeURLString;
}
// スラッシュを付けて返却
return '/' + relativeURLString;
};

View File

@ -15,7 +15,9 @@ export default function(title: string, siteName?: string): string {
for (let i = 0; i < patterns.length; i++) {
const pattern = new RegExp(patterns[i]);
const [, match] = pattern.exec(title) || [null, null];
if (match) return match;
if (match) {
return match;
}
}
}