Package Exports
- the-type-validator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (the-type-validator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

The type validator
Why ?
Javascript does not have a pretty way to prove something belongs to a specific type.
Ex1. checking typeof
typeof null
"object"
typeof undefined
"undefined"
typeof "undefined"
"string"
typeof Object
"function"
typeof object
"undefined"
typeof {}
"object"
typeof null
"object"
Ex2. comparing
true == 0
false
true == 1
true
true == 2
false
Solid ha?
Which types can i validate
- Null
- Undefined
- Function
- String
- Number
- Array
- Object
- Promise
Available methods
- isNull
- isUndefined
- isFunction
- isString
- isNumber
- isInteger
- isFloat
- isArray
- isEmptyArray
- isObject
- isEmptyObject
- isPromise
- isEmpty
How to use it?
First you need to import it in your project
- The require way
let { isObject } = require("the-type-validator");
- The import way
import { isObject } from "the-type-validator";
. . .
All validator methods returns boolean
import { isObject, isNull, isUndefined } from "the-type-validator";
const aNull = null
const isVarObject = isObject(aNull)
const isVarNull = isNull(aNull)
const isVarUndefined = isUndefined(aNull)
console.log('isVarObject', isVarObject)
false
console.log('isVarNull', isVarNull)
true
console.log('isVarUndefined', isVarUndefined)
false
Powered by Deepertech