From 07adcdc558b919da63704cb89ddb40921fad6803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Tue, 4 Jun 2019 10:15:47 +0800 Subject: [PATCH] fix cr warning --- src/layouts/BasicLayout.tsx | 4 ++-- src/utils/utils.ts | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index deb54079..c6cc156c 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -50,14 +50,14 @@ const footerRender: BasicLayoutProps['footerRender'] = (_, defaultDom) => { {defaultDom}
netlify logo diff --git a/src/utils/utils.ts b/src/utils/utils.ts index beddb201..e7c70ce3 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,22 +1,24 @@ /* eslint no-useless-escape:0 import/prefer-default-export:0 */ const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; -export function isUrl(path: string) { +const isUrl = (path: string): boolean => { return reg.test(path); -} +}; -export function isAntDesignPro(): boolean { +const isAntDesignPro = (): boolean => { if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { return true; } return window.location.hostname === 'preview.pro.ant.design'; -} +}; // 给官方演示站点用,用于关闭真实开发环境不需要使用的特性 -export function isAntDesignProOrDev(): boolean { +const isAntDesignProOrDev = (): boolean => { const { NODE_ENV } = process.env; if (NODE_ENV === 'development') { return true; } return isAntDesignPro(); -} +}; + +export { isAntDesignProOrDev, isAntDesignPro, isUrl }; -- GitLab