| | |
| | | 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, |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | |