Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: recommend note.com #217

Merged
merged 1 commit into from Apr 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/model/recommend.ts
Expand Up @@ -6,6 +6,7 @@ const PATTERN_LIST = [
/(^w\.atwiki\.jp\/[^/]+\/)/,
/(^wikiwiki\.jp\/[^/]+\/)/,
/(^news\.yahoo\.co\.jp\/byline\/[^/]+\/)/,
/(^note\.com\/[^/]+)/,
];

function search(urlWithoutProtocol: string, pattern: RegExp): string | null {
Expand Down
5 changes: 5 additions & 0 deletions test/recommend.test.ts
Expand Up @@ -41,4 +41,9 @@ describe('makeRecommendUrl', () => {
);
expect(makeRecommendUrl('news.yahoo.co.jp/byline/')).toBe(null);
});

it('note.com', () => {
expect(makeRecommendUrl('note.com/ikemo/n/n30cca332ccd3')).toBe('note.com/ikemo');
expect(makeRecommendUrl('note.com/ikemo')).toBe(null);
});
});