{"id":15365605,"url":"https://github.com/tunnckocore/assert-kindof","last_synced_at":"2025-04-15T09:52:34.219Z","repository":{"id":29517289,"uuid":"33055692","full_name":"tunnckoCore/assert-kindof","owner":"tunnckoCore","description":"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.","archived":false,"fork":false,"pushed_at":"2023-01-12T05:36:01.000Z","size":474,"stargazers_count":4,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T07:42:51.440Z","etag":null,"topics":["assert","assertion-library","assertions","checking","kind","kindof","natives","simple","type","typeof","utils","validate"],"latest_commit_sha":null,"homepage":"http://j.mp/19crqvf","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tunnckoCore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-29T00:23:19.000Z","updated_at":"2022-09-13T09:44:50.000Z","dependencies_parsed_at":"2023-01-14T15:06:35.333Z","dependency_job_id":null,"html_url":"https://github.com/tunnckoCore/assert-kindof","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fassert-kindof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fassert-kindof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fassert-kindof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Fassert-kindof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tunnckoCore","download_url":"https://codeload.github.com/tunnckoCore/assert-kindof/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048711,"owners_count":21204305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assert","assertion-library","assertions","checking","kind","kindof","natives","simple","type","typeof","utils","validate"],"created_at":"2024-10-01T13:15:13.422Z","updated_at":"2025-04-15T09:52:34.193Z","avatar_url":"https://github.com/tunnckoCore.png","language":"JavaScript","readme":"# assert-kindof [![NPM version](https://img.shields.io/npm/v/assert-kindof.svg?style=flat)](https://www.npmjs.com/package/assert-kindof) [![mit license][license-img]][license-url] [![NPM monthly downloads](https://img.shields.io/npm/dm/assert-kindof.svg?style=flat)](https://npmjs.org/package/assert-kindof) [![npm total downloads][downloads-img]][downloads-url]\n\n\u003e Check native type of value and throw AssertionError if not okey. Clean stack traces. Simplicity. Built on [is-kindof][].\n\n[![code climate][codeclimate-img]][codeclimate-url] \n[![code style][standard-img]][standard-url] \n[![linux build][travis-img]][travis-url] \n[![windows build][appveyor-img]][appveyor-url] \n[![code coverage][coverage-img]][coverage-url] \n[![dependency status][david-img]][david-url]\n[![paypal donate][paypalme-img]][paypalme-url] \n\nYou might also be interested in [kind-of-extra](https://github.com/tunnckocore/kind-of-extra#readme).\n\n## Highlights\n- **simplicity:** pretty simple and stable codebase, built on [kind-of][] and [kind-of-extra][]\n- **flexibility:** expose methods for each javascript type, using [kind-of-types][]\n- **better coverage:** ensures that your code will not have many branches\n- **clean stack traces:** clean and small stack traces, using [clean-stacktrace][]\n- **type checking:** exposes [is-kindof][] methods for returning booleans\n- **negations:** support \"not\" modifier, e.g. `is.not.array(val)`\n- **errors:** enhanced error objects with `actual`, `expected`, `operator` and `value` props\n- **messages:** customizable and clean error messages\n\n## Table of Contents\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n  * [.is](#is)\n  * [.array](#array)\n  * [.boolean](#boolean)\n  * [.buffer](#buffer)\n  * [.date](#date)\n  * [.error](#error)\n  * [.function](#function)\n  * [.generator](#generator)\n  * [.generatorfunction](#generatorfunction)\n  * [.map](#map)\n  * [.null](#null)\n  * [.number](#number)\n  * [.object](#object)\n  * [.promise](#promise)\n  * [.regexp](#regexp)\n  * [.set](#set)\n  * [.stream](#stream)\n  * [.string](#string)\n  * [.symbol](#symbol)\n  * [.undefined](#undefined)\n  * [.weakmap](#weakmap)\n  * [.weakset](#weakset)\n- [Related](#related)\n- [Contributing](#contributing)\n- [Building docs](#building-docs)\n- [Running tests](#running-tests)\n- [Author](#author)\n- [License](#license)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\nInstall with [npm](https://www.npmjs.com/)\n\n```\n$ npm install assert-kindof --save\n```\n\nor install using [yarn](https://yarnpkg.com)\n\n```\n$ yarn add assert-kindof\n```\n\n## Usage\n\u003e For more use-cases see the [tests](test.js)\n\n```js\nconst assertKindof = require('assert-kindof')\n```\n\n## API\n\n### [.is](index.js#L139)\n\u003e All methods from [is-kindof][] are also exposed, so check its docs. That `.is` is object with methods with same names as in this package.\n\n**Example**\n\n```js\nvar assertKindof = require('assert-kindof')\n\nassertKindof.is.array(123) // =\u003e false\nassertKindof.is.array([11, 22, 33]) // =\u003e true\n\nassertKindof.array([11, 22, 33]) // =\u003e not throws\n\ntry {\n  assertKindof.array(123) // =\u003e AssertionError: number !== array\n} catch (err) {\n  console.log(err.message) // =\u003e 'number !== array'\n}\n```\n\n### [.array](index.js#L169)\n\u003e Check `value` is array, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.array([1, 2, 3]) // =\u003e not throws\nassert.array(123) // =\u003e AssertionError: number !== array\n\ntry {\n  assert.array({ foo: 'bar' }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be array'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e array\n  console.log(err.value) // =\u003e { foo: 'bar' }\n}\n```\n\n### [.boolean](index.js#L199)\n\u003e Check `value` is boolean, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.boolean(true) // =\u003e not throws\nassert.boolean(false) // =\u003e not throws\nassert.boolean(123) // =\u003e AssertionError: number !== boolean\nassert.boolean(null) // =\u003e AssertionError: null !== boolean\n\ntry {\n  assert.boolean([1, 2, 3], 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be boolean'\n  console.log(err.actual) // =\u003e array\n  console.log(err.expected) // =\u003e boolean\n  console.log(err.value) // =\u003e [1, 2, 3]\n}\n```\n\n### [.buffer](index.js#L227)\n\u003e Check `value` is buffer, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.buffer(new Buffer('foo')) // =\u003e not throws\nassert.buffer(123) // =\u003e AssertionError: number !== buffer\n\ntry {\n  assert.buffer(true, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be buffer'\n  console.log(err.actual) // =\u003e boolean\n  console.log(err.expected) // =\u003e buffer\n  console.log(err.value) // =\u003e true\n}\n```\n\n### [.date](index.js#L255)\n\u003e Check `value` is date, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.date(new Date()) // =\u003e not throws\nassert.date(123) // =\u003e AssertionError: number !== date\n\ntry {\n  assert.date({ a: 'b' }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be date'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e date\n  console.log(err.value) // =\u003e { a: 'b' }\n}\n```\n\n### [.error](index.js#L284)\n\u003e Check `value` is error, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.error(new Error()) // =\u003e not throws\nassert.error(new TypeError()) // =\u003e not throws\nassert.error(123) // =\u003e AssertionError: number !== error\n\ntry {\n  assert.error({ a: 'b' }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be error'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e error\n  console.log(err.value) // =\u003e { a: 'b' }\n}\n```\n\n### [.function](index.js#L316)\n\u003e Check `value` is function, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.function(function noop () {}) // =\u003e not throws\nassert.function((a, b) =\u003e {}) // =\u003e not throws\nassert.function(123) // =\u003e AssertionError: number !== error\n\nassert.function(function * noop () {})\n// =\u003e AssertionError: generatorfunction !== function\n\ntry {\n  assert.function({ a: 'b' }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be function'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e function\n  console.log(err.value) // =\u003e { a: 'b' }\n}\n```\n\n### [.generator](index.js#L349)\n\u003e Check `value` is generator, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar generator = (function * gen () { yield 42 })()\nvar genFn = function * genFn () {}\nvar noop = () =\u003e { return 123 }\n\nassert.generator(generator) // =\u003e not throws\nassert.generator(genFn) // =\u003e AssertionError: generatorfunction !== generator\nassert.generator(noop) // =\u003e AssertionError: function !== generator\nassert.generator(123) // =\u003e AssertionError: number !== generator\n\ntry {\n  assert.generator({ a: 'b' }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be generator'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e generator\n  console.log(err.value) // =\u003e { a: 'b' }\n}\n```\n\n### [.generatorfunction](index.js#L383)\n\u003e Check `value` is generator function, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar generator = (function * gen () { yield 42 })()\nvar genFn = function * genFn () {}\nvar noop = () =\u003e { return 123 }\n\nassert.generatorfunction(genFn) // =\u003e not throws\n\nassert.generatorfunction(generator) // =\u003e AssertionError: generator !== generatorfunction\nassert.generatorfunction(noop) // =\u003e AssertionError: function !== generatorfunction\nassert.generatorfunction(123) // =\u003e AssertionError: number !== generatorfunction\n\ntry {\n  assert.generatorfunction({ a: 'b' }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be generatorfunction'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e generatorfunction\n  console.log(err.value) // =\u003e { a: 'b' }\n}\n```\n\n### [.map](index.js#L412)\n\u003e Check `value` is ES2015/ES6 Map, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.map(new Map()) // =\u003e not throws\nassert.map(new WeakMap()) // =\u003e AssertionError: weakmap !== map\nassert.map(123) // =\u003e AssertionError: number !== map\n\ntry {\n  assert.map(123, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be map'\n  console.log(err.actual) // =\u003e number\n  console.log(err.expected) // =\u003e map\n  console.log(err.value) // =\u003e { a: 'b' }\n}\n```\n\n### [.null](index.js#L441)\n\u003e Check `value` is null, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.null(null) // =\u003e not throws\nassert.null({ a: 'b' }) // =\u003e AssertionError: object !== null\nassert.null(123) // =\u003e AssertionError: number !== null\n\ntry {\n  assert.null(123, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be null'\n  console.log(err.actual) // =\u003e number\n  console.log(err.expected) // =\u003e null\n  console.log(err.value) // =\u003e 123\n}\n```\n\n### [.number](index.js#L470)\n\u003e Check `value` is number, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.number(123) // =\u003e not throws\nassert.number({ a: 'b' }) // =\u003e AssertionError: object !== number\nassert.number(null) // =\u003e AssertionError: null !== number\n\ntry {\n  assert.number([111, 222], 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be number'\n  console.log(err.actual) // =\u003e array\n  console.log(err.expected) // =\u003e number\n  console.log(err.value) // =\u003e [111, 222]\n}\n```\n\n### [.object](index.js#L499)\n\u003e Check `value` is object, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.object({ aaa: 'bbb' }) // =\u003e not throws\nassert.object([1, 2, 3]) // =\u003e AssertionError: array !== object\nassert.object(null) // =\u003e AssertionError: null !== object\n\ntry {\n  assert.object([111, 222], 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be object'\n  console.log(err.actual) // =\u003e array\n  console.log(err.expected) // =\u003e object\n  console.log(err.value) // =\u003e [111, 222]\n}\n```\n\n### [.promise](index.js#L530)\n\u003e Check `value` is promise, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.promise(Promise.resolve(123)) // =\u003e not throws\nassert.promise(Promise.reject(new Error('foo'))) // =\u003e not throws\n\nassert.promise(new Map()) // =\u003e AssertionError: map !== promise\nassert.promise(123) // =\u003e AssertionError: number !== promise\n\ntry {\n  assert.promise({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be promise'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e promise\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.regexp](index.js#L561)\n\u003e Check `value` is regexp, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.regexp(/foo ba?r abz/i) // =\u003e not throws\nassert.regexp(new RegExp('aa bb')) // =\u003e not throws\n\nassert.regexp(new Map()) // =\u003e AssertionError: map !== regexp\nassert.regexp(123) // =\u003e AssertionError: number !== regexp\n\ntry {\n  assert.regexp({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be regexp'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e regexp\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.set](index.js#L590)\n\u003e Check `value` is ES2015/ES6 Set, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.set(new Set()) // =\u003e not throws\nassert.set(new Map()) // =\u003e AssertionError: map !== set\nassert.set(123) // =\u003e AssertionError: number !== set\n\ntry {\n  assert.set({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be set'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e set\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.stream](index.js#L621)\n\u003e Check `value` is stream, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar through2 = require('through2')\nassert.stream(through2()) // =\u003e not throws\nassert.stream(through2.obj()) // =\u003e not throws\n\nassert.stream(new Map()) // =\u003e AssertionError: map !== stream\nassert.stream(123) // =\u003e AssertionError: number !== stream\n\ntry {\n  assert.stream({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be stream'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e stream\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.string](index.js#L653)\n\u003e Check `value` is string, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar fn = function aa () { return 123 }\nassert.string('foo bar baz') // =\u003e not throws\nassert.string(fn.toString()) // =\u003e not throws\nassert.string(new String('abc')) // =\u003e not throws\n\nassert.string(new Map()) // =\u003e AssertionError: map !== string\nassert.string(123) // =\u003e AssertionError: number !== string\n\ntry {\n  assert.string({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be string'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e string\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.symbol](index.js#L683)\n\u003e Check `value` is Symbol, if not throws AssertionError.\n\nvar assert = require('assert-kindof')*\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nassert.symbol(Symbol()) // =\u003e not throws\n\nassert.symbol(new Map()) // =\u003e AssertionError: map !== symbol\nassert.symbol(123) // =\u003e AssertionError: number !== symbol\n\ntry {\n  assert.symbol({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be symbol'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e symbol\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.undefined](index.js#L714)\n\u003e Check `value` is undefined, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.undefined() // =\u003e not throws\nassert.undefined(undefined) // =\u003e not throws\n\nassert.undefined(new Map()) // =\u003e AssertionError: map !== undefined\nassert.undefined(123) // =\u003e AssertionError: number !== undefined\n\ntry {\n  assert.undefined({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be undefined'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e undefined\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.weakmap](index.js#L745)\n\u003e Check `value` is ES2015/ES6 WeakMap, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.weakmap(new WeakMap()) // =\u003e not throws\n\nassert.weakmap(new WeakSet()) // =\u003e AssertionError: weakset !== weakmap\nassert.weakmap(new Map()) // =\u003e AssertionError: map !== weakmap\nassert.weakmap(123) // =\u003e AssertionError: number !== weakmap\n\ntry {\n  assert.weakmap({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be weakmap'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e weakmap\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n### [.weakset](index.js#L776)\n\u003e Check `value` is ES2015/ES6 WeakSet, if not throws AssertionError.\n\n**Params**\n\n* `value` **{any}**: value to be checked    \n* `message` **{String|Function}**: error message; if function gets `fn(actual, expected, value)` signature    \n* `returns` **{Undefined}**: nothing is returned, throws if not okey  \n\n**Example**\n\n```js\nvar assert = require('assert-kindof')\nassert.weakmap(new WeakSet()) // =\u003e not throws\n\nassert.weakset(new WeakMap()) // =\u003e AssertionError: weakmap !== weakset\nassert.weakset(new Map()) // =\u003e AssertionError: map !== weakset\nassert.weakset(123) // =\u003e AssertionError: number !== weakset\n\ntry {\n  assert.weakset({ a: 1 }, 'expect `val` to be {expected}')\n} catch (err) {\n  console.log(err.message) // =\u003e 'expect `val` to be weakset'\n  console.log(err.actual) // =\u003e object\n  console.log(err.expected) // =\u003e weakset\n  console.log(err.value) // =\u003e { a: 1 }\n}\n```\n\n## Related\n- [always-done](https://www.npmjs.com/package/always-done): Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement… [more](https://github.com/hybridables/always-done#readme) | [homepage](https://github.com/hybridables/always-done#readme \"Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement for [async-done][] - pass 100% of its tests plus more\")\n- [assertit](https://www.npmjs.com/package/assertit): Thin sugar layer on top of `testit` framework, `is-kindof` and `assert`. | [homepage](https://github.com/tunnckoCore/assertit \"Thin sugar layer on top of `testit` framework, `is-kindof` and `assert`.\")\n- [is-kindof](https://www.npmjs.com/package/is-kindof): Check type of given javascript value. Support promises, generators, streams, and native types. Built on [kind-of][] lib. | [homepage](https://github.com/tunnckocore/is-kindof#readme \"Check type of given javascript value. Support promises, generators, streams, and native types. Built on [kind-of][] lib.\")\n- [kind-of-extra](https://www.npmjs.com/package/kind-of-extra): Additional functionality to [kind-of][] type check utility. Support promises, generators, streams, errors. | [homepage](https://github.com/tunnckocore/kind-of-extra#readme \"Additional functionality to [kind-of][] type check utility. Support promises, generators, streams, errors.\")\n- [kind-of-types](https://www.npmjs.com/package/kind-of-types): List of all javascript types. Used and useful for checking, validation, sanitizing and testing. Like isStream, isPromise, isWeakset and etc. | [homepage](https://github.com/tunnckocore/kind-of-types#readme \"List of all javascript types. Used and useful for checking, validation, sanitizing and testing. Like isStream, isPromise, isWeakset and etc.\")\n- [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of \"Get the native type of a value.\")\n- [mukla](https://www.npmjs.com/package/mukla): Small, parallel and fast test framework with suppport for async/await, promises, callbacks, streams and observables. Targets and works at node.js… [more](https://github.com/tunnckocore/mukla#readme) | [homepage](https://github.com/tunnckocore/mukla#readme \"Small, parallel and fast test framework with suppport for async/await, promises, callbacks, streams and observables. Targets and works at node.js v0.10 and above.\")\n- [try-catch-callback](https://www.npmjs.com/package/try-catch-callback): try/catch block with a callback, used in [try-catch-core][]. Use it when you don't care about asyncness so much and don't… [more](https://github.com/hybridables/try-catch-callback#readme) | [homepage](https://github.com/hybridables/try-catch-callback#readme \"try/catch block with a callback, used in [try-catch-core][]. Use it when you don't care about asyncness so much and don't want guarantees. If you care use [try-catch-core][].\")\n- [try-catch-core](https://www.npmjs.com/package/try-catch-core): Low-level package to handle completion and errors of sync or asynchronous functions, using [once][] and [dezalgo][] libs. Useful for and… [more](https://github.com/hybridables/try-catch-core#readme) | [homepage](https://github.com/hybridables/try-catch-core#readme \"Low-level package to handle completion and errors of sync or asynchronous functions, using [once][] and [dezalgo][] libs. Useful for and used in higher-level libs such as [always-done][] to handle completion of anything.\")\n- [try-read-json](https://www.npmjs.com/package/try-read-json): Graceful reading of JSON value, using JSON.parse with support for optional callback | [homepage](https://github.com/tunnckocore/try-read-json#readme \"Graceful reading of JSON value, using JSON.parse with support for optional callback\")\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/tunnckoCore/assert-kindof/issues/new).  \nPlease read the [contributing guidelines](CONTRIBUTING.md) for advice on opening issues, pull requests, and coding standards.  \nIf you need some help and can spent some cash, feel free to [contact me at CodeMentor.io](https://www.codementor.io/tunnckocore?utm_source=github\u0026utm_medium=button\u0026utm_term=tunnckocore\u0026utm_campaign=github) too.\n\n**In short:** If you want to contribute to that project, please follow these things\n\n1. Please DO NOT edit [README.md](README.md), [CHANGELOG.md](CHANGELOG.md) and [.verb.md](.verb.md) files. See [\"Building docs\"](#building-docs) section.\n2. Ensure anything is okey by installing the dependencies and run the tests. See [\"Running tests\"](#running-tests) section.\n3. Always use `npm run commit` to commit changes instead of `git commit`, because it is interactive and user-friendly. It uses [commitizen][] behind the scenes, which follows Conventional Changelog idealogy.\n4. Do NOT bump the version in package.json. For that we use `npm run release`, which is [standard-version][] and follows Conventional Changelog idealogy.\n\nThanks a lot! :)\n\n## Building docs\nDocumentation and that readme is generated using [verb-generate-readme][], which is a [verb][] generator, so you need to install both of them and then run `verb` command like that\n\n```\n$ npm install verbose/verb#dev verb-generate-readme --global \u0026\u0026 verb\n```\n\n_Please don't edit the README directly. Any changes to the readme must be made in [.verb.md](.verb.md)._\n\n## Running tests\nClone repository and run the following in that cloned directory\n\n```\n$ npm install \u0026\u0026 npm test\n```\n\n## Author\n**Charlike Mike Reagent**\n\n+ [github/tunnckoCore](https://github.com/tunnckoCore)\n+ [twitter/tunnckoCore](https://twitter.com/tunnckoCore)\n+ [codementor/tunnckoCore](https://codementor.io/tunnckoCore)\n\n## License\nCopyright © 2015, 2017, [Charlike Mike Reagent](http://www.tunnckocore.tk). Released under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 10, 2017._  \n_Project scaffolded using [charlike][] cli._\n\n[always-done]: https://github.com/hybridables/always-done\n[async-done]: https://github.com/gulpjs/async-done\n[charlike]: https://github.com/tunnckocore/charlike\n[clean-stacktrace]: https://github.com/tunnckocore/clean-stacktrace\n[commitizen]: https://github.com/commitizen/cz-cli\n[dezalgo]: https://github.com/npm/dezalgo\n[is-kindof]: https://github.com/tunnckocore/is-kindof\n[kind-of-extra]: https://github.com/tunnckocore/kind-of-extra\n[kind-of-types]: https://github.com/tunnckocore/kind-of-types\n[kind-of]: https://github.com/jonschlinkert/kind-of\n[once]: https://github.com/isaacs/once\n[standard-version]: https://github.com/conventional-changelog/standard-version\n[try-catch-core]: https://github.com/hybridables/try-catch-core\n[verb-generate-readme]: https://github.com/verbose/verb-generate-readme\n[verb]: https://github.com/verbose/verb\n\n[license-url]: https://www.npmjs.com/package/assert-kindof\n[license-img]: https://img.shields.io/npm/l/assert-kindof.svg\n\n[downloads-url]: https://www.npmjs.com/package/assert-kindof\n[downloads-img]: https://img.shields.io/npm/dt/assert-kindof.svg\n\n[codeclimate-url]: https://codeclimate.com/github/tunnckoCore/assert-kindof\n[codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCore/assert-kindof.svg\n\n[travis-url]: https://travis-ci.org/tunnckoCore/assert-kindof\n[travis-img]: https://img.shields.io/travis/tunnckoCore/assert-kindof/master.svg?label=linux\n\n[appveyor-url]: https://ci.appveyor.com/project/tunnckoCore/assert-kindof\n[appveyor-img]: https://img.shields.io/appveyor/ci/tunnckoCore/assert-kindof/master.svg?label=windows\n\n[coverage-url]: https://codecov.io/gh/tunnckoCore/assert-kindof\n[coverage-img]: https://img.shields.io/codecov/c/github/tunnckoCore/assert-kindof/master.svg\n\n[david-url]: https://david-dm.org/tunnckoCore/assert-kindof\n[david-img]: https://img.shields.io/david/tunnckoCore/assert-kindof.svg\n\n[standard-url]: https://github.com/feross/standard\n[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n\n[paypalme-url]: https://www.paypal.me/tunnckoCore\n[paypalme-img]: https://img.shields.io/badge/paypal-donate-brightgreen.svg\n\n","funding_links":["https://www.paypal.me/tunnckoCore"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnckocore%2Fassert-kindof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftunnckocore%2Fassert-kindof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnckocore%2Fassert-kindof/lists"}