Package Exports
- assert-kindof
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 (assert-kindof) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Check native type of the given value and throw TypeError if not okey. Expressive, elegant, behavior-driven API, good descriptive default error messages, simple and clean syntax.
Differences
- tunnckoCore/is-kindof returns
true
orfalse
assert-kindof
returnstrue
or throwsTypeError
Install
npm i --save assert-kindof
npm test
Features
- clean and simple syntax
- expressive, behavior-driven api
- support custom error messages
- support error message formatter function
- good descriptive default error messages
- guarantee better code coverage
- only type-oriented checks
- enhanced TypeError object with more useful properties like
- actual, expected, line, filename, filepath, value, message
Supported types
- undefined
- null
- boolean
- buffer
- number
- string
- object
- date
- array
- regexp
- function
- map
- weakmap
- set
- weakset
- symbol
- error
So
is
andis.not
have method for all of them
Usage
For more use-cases see the tests
var is = require('assert-kindof');
is.object('foo'); //=> throw TypeError
is.a.object('foo'); //=> throw TypeError
is.an.object('foo'); //=> throw TypeError
is.not.a.object({a: 'b'}); //=> throw TypeError
is.not.an.object({a: 'b'}); //=> throw TypeError
is.a.not.object({a: 'b'}); //=> throw TypeError
is.an.not.object({a: 'b'}); //=> throw TypeError
is.kindof.object('foo'); //=> false
is.kindof.array('foo'); //=> false
is.kindof.null(null); //=> true
is.kindof.symbol('foo'); //=> false
is.kindof.symbol(Symbol('foo')); //=> true
notice: that tunnckoCore/is-kindof is exposed as is.kindof
Author
Charlike Mike Reagent
License 
Copyright (c) 2015 Charlike Mike Reagent, contributors.
Released under the MIT
license.
Proudly generated by docks(1), March 30, 2015