ts-object-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

ts-object-utils

Best way to check for null or undefined in typescript using a type guard. Other types also supported. Can strip out null or undefine or complex types like T | null etc.

npm install --save ts-object-utils

To use:

import ObjectUtil from "ts-object-utils";
 
let a: number | null = 0;
 
console.log(a*4); //Error: a might be null
 
if(!ObjectUtil.isNullOrUndefined(a)){
    console.log(a*4); //Works
}

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i ts-object-utils

      Weekly Downloads

      346,033

      Version

      0.0.5

      License

      ISC

      Last publish

      Collaborators

      • naqvitalha