Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-asserttype

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-asserttype

a simple chai plugin for asserting on types

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1K
increased by1.82%
Maintainers
1
Weekly downloads
 
Created
Source

chai-asserttype

a simple chai plugin for js type assertions


Installation

npm install chai-asserttype

Usage

plug-in

const chai = require('chai');
const asserttype = require('chai-asserttype');
chai.use(asserttype);

Number

Asserts that type of actual is Number.

expect(1).to.be.number();
expect(0).to.be.number();
expect(-1).to.be.number();
expect(63465789908753).to.be.number();
expect(27.11).to.be.number();

String

Asserts that type of actual is String.

expect('').to.be.string();
expect('foobar').to.be.string();

Boolean

Asserts that type of actual is Boolean.

expect(true).to.be.boolean();
expect(false).to.be.boolean();

Object

Asserts that type of actual is Object.

expect({}).to.be.object();

Array

Asserts that type of actual is Array.

expect([]).to.be.array();
expect([1, 2, 3]).to.be.array();

Date

Asserts that type of actual is date.

expect(new Date()).to.be.date();

Function

Asserts that type of actual is Function.

expect(() => true).to.be.function();

Keywords

FAQs

Package last updated on 18 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc