cxc-szcx-uniapp/uni_modules/lime-shared/isDef/index.ts
2025-02-11 17:09:35 +08:00

23 lines
570 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// @ts-nocheck
/**
* 检查一个值是否已定义(不为 undefined且不为 null
* @param value 要检查的值
* @returns 如果值已定义且不为 null则返回 true否则返回 false
*/
// #ifndef UNI-APP-X
export function isDef(value: unknown): boolean {
return value !== undefined && value !== null;
}
// #endif
// #ifdef UNI-APP-X
export function isDef(value : any|null) : boolean {
// #ifdef UNI-APP-X && APP
return value != null;
// #endif
// #ifndef UNI-APP-X && APP
return value != null && value != undefined;
// #endif
}
// #endif