icat_checktype

1.0.2 • Public • Published

How to use

let checkType = require("icat_checktype")

let user = function(name,age,sayFn,okBoolean){

  //Here use checkType

  checkType(
    arguments       //Array, params
    ,["string",["string","number","undefined"],      //string or number or undefined
    ,"function?"                                     //function or undefined
    ,"boolean"]     //Array, wishing type
    ,"user"         //String, name of function
  )

  //Attention!!! Because of Object.prototype.toString, class is function.

  return {
    name:name,
    age:age || "I don't know.",
    say:sayFn || function(){return "Hello, my name is "+this.name },
    ok:okBoolean,
  }

Readme

Keywords

Package Sidebar

Install

npm i icat_checktype

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

3.1 kB

Total Files

4

Last publish

Collaborators

  • blue_sdo