INNER CODE UNIT · TypeScript
isTwoFactorAuth
sindresorhus/caprine · source/index.ts:540
const isTwoFactorAuth = (url: string): boolean => {
const twoFactorAuthURL = 'https://www.facebook.com/checkpoint';
return url.startsWith(twoFactorAuthURL);
};
const isWorkChat = (url: string): boolean => {
const {hostname, pathname} = new URL(url);
if (hostname === 'work.facebook.com' || hostname === 'work.workplace.com') {
return true;
}
if (
// Example: https://company-name.facebook.com/login or
// https://company-name.workplace.com/login
(hostname.endsWith('.facebook.com') || hostname.endsWith('.workplace.com'))
&& (pathname.startsWith('/login') || pathname.startsWith('/chat'))
) {