2.2.7 • Published 2 years ago

type-check-utility v2.2.7

Weekly downloads
15
License
ISC
Repository
github
Last release
2 years ago

type-check-utility

This is a simple type check utility for JavaScript.

Demo

Type-Check-Utility CodeSandBox

functions

isDefined

Checks if given parameter is not null or undefined. Find below some examples.

Returns True: 2, "", "type-check-utility", [], {}
Returns False: null, undefined

isNumber

Checks if given parameter is of type number. Find below some examples.

Returns True: 0, 1, 2, 5.97E24
Returns False: "0", "1", null, undefined, [], {}

isString

Checks if given parameter is of type string. Find below some examples.

Returns True: "", "type-check-utility", "2"
Returns False: null, undefined, 2, [], {}

isObject

Checks if given parameter is of type object. Find below some examples.

Returns True: {}, namedClassInstance
Returns False: [], null, undefined

isArray

Checks if given parameter is of type array. Find below some examples.

Returns True: [], [1], [{}]
Returns False: null, undefined, {}

isRegex

Checks if given parameter is of type regex. Find below some examples.

Returns True: new RegExp(parameter), /^/
Returns False: [], null, undefined, ""

isNotDefinedOrEmpty

Checks if given parameter is of type null, undefined or '' (empty string). Find below some examples.

Returns True: null, undefined, ""
Returns False: [], " ", 1, 123, 0, true, false

isNotDefinedOrWhiteSpace

Checks if given parameter is of type null, undefined, '' (empty string) or white spaces. Find below some examples.

Returns True: null, undefined, "", " ", "   "
Returns False: [], 1, 123, 0, true, false

isNotDefinedOrEmptyObject

Checks if given parameter is of type null, undefined, '' (empty string), white spaces, empty object or empty array. Find below some examples.

Returns True: null, undefined, "", " ", "   ", {}, []
Returns False: 1, 123, 0, true, false

Developer Guide To Publish

  1. Make changes as needed.
  2. Change version in package.json.
  3. Run npm login to login in NPM account (if not logged-in already).
  4. Run npm publish.
  5. Shout it's done.

2.2.7

2 years ago

2.2.6

2 years ago

2.2.5

2 years ago

2.2.4

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago