From 50111114eb8254fe4d6fc15e9781f2c47e3db74a Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 24 七月 2024 00:12:52 +0800 Subject: [PATCH] 删除工艺路线绑定 --- src/utils/is.ts | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/utils/is.ts b/src/utils/is.ts index 7080731..c2d74ac 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -1,12 +1,11 @@ -import { isEmpty } from 'lodash-es'; /* * @Description: file content * @Author: your name * @version: * @Date: 2024-06-17 14:51:26 - * @LastEditors: your name - * @LastEditTime: 2024-06-17 15:43:58 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-07-15 20:37:07 */ export { isArguments, @@ -116,7 +115,23 @@ } export function isNullOrEmpty(val: unknown): val is null | undefined { - return isNullOrUnDef(val) || isEmpty(val); + return isNullOrUnDef(val) || isEmpty2(val); +} + +export function isEmpty2(value: any): boolean { + if (value === null || value === undefined) { + return true; + } + if (typeof value === 'string' && value.trim() === '') { + return true; + } + if (Array.isArray(value) && value.length === 0) { + return true; + } + if (typeof value === 'object' && value !== null && Object.keys(value).length === 0) { + return true; + } + return false; } -- Gitblit v1.9.3