3.0.4 • Published 1 year ago

custom-typeof v3.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

CustomTypeof

Check your types more easily! CustomTypeof is a JavaScript utility class that provides additional type checking capabilities beyond the built-in typeof operator. CustomTypeof offer you two way to check your values types. One is using check method for check a single value type in more readable way, Rest of them can check n values

Installation

You can install the CustomTypeof class via npm:

npm install custom-typeof

or use yarn:

yarn add custom-typeof

Usage

To use the CustomTypeof class, you first need to import it:

const CustomTypeof = require("custom-typeof");

Then, you can create an instance of the class:

const customTypeof = new CustomTypeof();

The CustomTypeof class provides the following methods:

  • check
  • isArray
  • isNotArray
  • isObject
  • isNotObject
  • isBoolean
  • isNotBoolean
  • isString
  • isNotString
  • isNumber
  • isNotNumber
  • isStringNumber
  • isNotStringNumber
  • isFunction
  • isNotFunction
  • isUndefined
  • isNotUndefined
  • isNull
  • isNotNull
  • isTruthy
  • isFalsy

Except for the check method, the others can receive multiple values as parameters

Examples

check

const { check } = customTypeof;
check({}).type.isObject; // true
check([]).type.isObject; // false
check([]).type.isNotObject; // true

isString

Checks if a value is an string.

customTypeof.isString(...values);

Parameters:

values - The values to check.

Returns:

true if the value is an string, false otherwise.

isNotString

Checks if a value is not an string.

customTypeof.isNotString(...values);

Parameters:

values - The values to check.

Returns:

true if the value is not an string, false otherwise.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

3.0.4

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago