1.0.9 • Published 12 months ago

@alexevs/ts-guards v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

TS Guards logo

Description

Typescript guards

  • Install the npm package @alexevs/ts-guards

    // with npm
    npm i @alexevs/ts-guards
    // with yarn
    yarn add @alexevs/ts-guards
  • Use the package

    import { 
      isNull,
      isUndefined,
      isNil, 
      isEmpty 
    } from '@alexevs/ts-guards';
    
    console.log(isNull(null)); // true
    
    console.log(isUndefined(undefined)); // true
    
    console.log(isNil(null)); // true
    console.log(isNil(undefined)); // true
    
    console.log(isEmpty(undefined)); // true
    console.log(isEmpty(null)); // true
    console.log(isEmpty(false)); // false
    console.log(isEmpty(true)); // false
    console.log(isEmpty(0)); // false
    console.log(isEmpty(1)); // false
    console.log(isEmpty('')); // true
    console.log(isEmpty('str')); // false
    console.log(isEmpty([])); // true
    console.log(isEmpty([1, 2, 3])); // false
    console.log(isEmpty({})); // true
    console.log(isEmpty({ name: 'Alex' })); // false

Why?

Enhance your TypeScript projects with @alexevs/ts-guards!

This library provides a robust set of utility functions to simplify and streamline type-checking and guard validation in your code.

With ts-guards, you can ensure safer and readable type validation, improving code reliability and reducing potential errors.

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.7.4

1 year ago

0.7.3

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.0

1 year ago