mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixed issue with binding when binding to a falsy object (also added types.isNullOrundefined function).
This commit is contained in:
9
utils/types.d.ts
vendored
9
utils/types.d.ts
vendored
@@ -28,12 +28,19 @@
|
||||
export function isUndefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is defined (not null and not undefined).
|
||||
* A function that checks if something is defined (not undefined).
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is defined.
|
||||
*/
|
||||
export function isDefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is not defined (null or undefined).
|
||||
* @param value The value which will be checked.
|
||||
* Returns true if value is null or undefined.
|
||||
*/
|
||||
export function isNullOrUndefined(value: any): boolean;
|
||||
|
||||
/**
|
||||
* A function that checks if something is a valid function.
|
||||
* @param value The value which will be checked.
|
||||
|
||||
@@ -21,6 +21,10 @@ export function isDefined(value: any): boolean {
|
||||
return typeof value !== "undefined";
|
||||
}
|
||||
|
||||
export function isNullOrUndefined(value: any): boolean {
|
||||
return (typeof value === "undefined") || (value === null);
|
||||
}
|
||||
|
||||
export function verifyCallback(value: any) {
|
||||
if (value && !isFunction(value)) {
|
||||
throw new TypeError("Callback must be a valid function.");
|
||||
|
||||
Reference in New Issue
Block a user