Socket
Socket
Sign inDemoInstall

ts-object-utils

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ts-object-utils

Best type safe way to check null or undefined in typescript


Version published
Weekly downloads
347K
decreased by-2.6%
Maintainers
1
Install size
6.60 kB
Created
Weekly downloads
 

Readme

Source

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
}

FAQs

Last updated on 21 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc