feat: 初始化
This commit is contained in:
23
uni_modules/lime-shared/isDef/index.ts
Normal file
23
uni_modules/lime-shared/isDef/index.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// @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 APP-ANDROID || APP-IOS
|
||||
return value != null;
|
||||
// #endif
|
||||
// #ifndef APP-ANDROID || APP-IOS
|
||||
return value != null && value != undefined;
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
Reference in New Issue
Block a user