ts-object-utils
Advanced tools
export declare class Default { | ||
static value<T>(obj: any, defaultValue: T): T; | ||
static value<T>(obj: T | null | undefined, defaultValue: T): T; | ||
} |
{ | ||
"name": "ts-object-utils", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Best type safe way to check null or undefined in typescript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { ObjectUtil } from "./ObjectUtil"; | ||
export class Default { | ||
public static value<T>(obj: any, defaultValue: T): T { | ||
public static value<T>(obj: T | null | undefined, defaultValue: T): T { | ||
return ObjectUtil.isNullOrUndefined(obj) ? defaultValue : obj; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
5967
0.59%