Skip to content

Latest commit

 

History

History
92 lines (80 loc) · 1.96 KB

api.md

File metadata and controls

92 lines (80 loc) · 1.96 KB

Typis : Object

Kind: global constant

Typis.get(object) ⇒ string

Get object type

Kind: static method of Typis

ParamTypeDescription
objectObject

object

Example

typis.get('hello'); //=> String

Typis.is(object, type) ⇒ boolean

Check object type

Kind: static method of Typis

ParamTypeDescription
objectObject

object

typestring

type string can be also lowercase

Example

typis.is('hello', 'number'); //=> false

Typis.throw(object, type, [msg]) ⇒ boolean

Check object type and throw an error if not satisfied

Kind: static method of Typis

ParamTypeDescription
objectObject

object

typestring

type string can be also lowercase

[msg]string

message error

Example

try {
     typis.throw('hello', 'number');
} catch(e) {
     console.log(e);
}