v1.9.0
The next powerful test inspection framework for Node.js and the web

Docs ยป Examples

Inspection methods: 133

Type comparison

  • Inspects whether input is a string
  • Inspects whether input is not a string
  • Inspects whether input is a number
  • Inspects whether input is not a number
  • Inspects whether input is an object
  • Inspects whether input is not an object
  • Inspects whether input is an array
  • Inspects whether input is not an array
  • Inspects whether input is a function
  • Inspects whether input is not function
  • Inspects whether input is a class
  • Inspects whether input is not a class
  • Inspects whether input is a generator function
    This test will pass on environments without generator support if type of input value is function!
  • Inspects whether input is not generator function
  • Inspects whether input is a promise.
    A promise is identified if input type is an object and if input has a then and a catch method
  • Inspects whether input is not promise
  • Inspects whether input is a regexp
  • Inspects whether input is not a regexp
  • Inspects whether input is a date object
  • Inspects whether input is not a date
  • Inspects whether input is a date string
    This can be any type of date strings.
  • Inspects whether input is not a class
  • Inspects whether input is a boolean
  • Inspects whether input is not a boolean
  • Inspects whether input is NaN
  • Inspects whether input is not a NaN
  • Inspects whether input is one of these types.
    types could be string number array null object boolean true false function promise class or undefined
  • Inspects whether input is not one of any types.
    types could be all what utils.getTypeOf is supporting
  • Inspects whether input is an instance of a specific prototype or class
  • Inspects whether input is not an instance of a specific prototype or class
  • Inspects whether input is a valid JSON object
  • Inspects whether input is not a valid JSON object
  • Inspects whether input is a valid JSON string
  • Inspects whether input is not a valid JSON string

Value existance

  • Inspects whether input is empty
    This tests passes if value is one of "" [] or {}
  • Inspects whether input is not empty
    This tests passes if value is other than "" [] or {}
  • Inspects whether input has a specific method
  • Inspects whether input has not a specific method
  • Inspects whether input has a specific key
  • Inspects whether input doesn't has a specific key
  • Inspects whether input has all of this keys
  • Inspects whether input has none of this keys
  • Inspects whether input has any of these keys
  • Inspects whether input should not has any of these keys
  • Inspects whether input has a property with a specified value
  • Inspects whether input has not a property with a specified value
  • Inspects whether input has all of this properties
  • Inspects whether input has none of these properties
  • Inspects whether input has a specific length
    Accepts arrays or strings as input values
  • Inspects whether input has not a specific length
    Accepts arrays or strings as input values
  • Inspects whether input has a specific min length
    Accepts arrays or strings as input values
  • Inspects whether input has a specific max length
    Accepts arrays or strings as input values
  • Inspects whether an array has a specific value
  • Inspects whether an array has not a specific value
  • Inspects whether input has been inherited by a specific object
  • Inspects whether input has not been inherited by a specific object

Value comparison

  • Inspects whether input is eql to a value.
    This makes a value comparison.
  • Inspects whether input is not eql to a value.
    This makes a value comparison.
  • Inspects whether input is equal to a value.
    This makes a === comparison
  • Inspects whether input is not equal to a value.
    This makes a !== comparison
  • Inspects whether input is true
  • Inspects whether input is not === true
  • Inspects whether input is false
  • Inspects whether input is not false
  • Inspects whether input is truthy
    This tests passes if value is not 0 "" null NaN or undefined
  • Inspects whether input is falsy
    This tests passes if value is one of 0 "" null NaN or undefined
  • Inspects whether input is null
  • Inspects whether input is not null
  • Inspects whether input is undefined
  • Inspects whether input is not undefined
  • Inspects whether input matches against a regular expression
  • Inspects whether input does not matche against a regular expression
  • Inspects whether input starts with a specific string
  • Inspects whether input starts not with a specific string
  • Inspects whether input ends with a specific string
  • Inspects whether input ends not with a specific string
  • Inspects whether a number is greater than value
  • Inspects whether input is greater than or equal to num
  • Inspects whether input is lesser than num
  • Inspects whether input is lesser than or equal to num
  • Inspects whether a string contains a specific value
  • Inspects whether a string does not contains a specific value
  • Inspects whether a string contains a specific value only once
  • Inspects whether an array has all of these value(s)
  • Inspects whether an array has none of these values
  • Inspects whether an array has any of these values
  • Inspects whether an array has not any of these values
  • Inspects whether a number is within a specivic range
  • Inspects whether a number is not within a specivic range
  • Inspects whether an array contains a subset of an array in the same order
  • Inspects whether an array does not contains a subset of an array in the same order
  • Inspects whether a number is close to num by a given range
  • Inspects whether a number is close to num by a given range

Behavior testing

  • Inspects whether a function throws an exception
  • Inspects whether a function does not throw an exception
  • Inspects whether an function call increases a property
  • Inspects whether an function call decreases a property
  • Inspects whether an function call changes a property
  • Inspects whether an function call does not change a property
  • Cals a function
  • Calls input as a function with args
  • Calls input as a function with args

Node.js extras

  • Inspects whether a file exists
  • Inspects whether a file not exists
  • Inspects whether a file exists and it is a file
  • Inspects whether a file does not exists or it is not a file
  • Inspects whether a file exists and it is a directory
  • Inspects whether a file/dir does not exists or it is not a directory
  • Inspect whether a file contains a certain content
  • Inspect whether a file contains a certain content

Misc

  • Converts a value in a readable value
  • Returns an array element by a given index
  • Inspects whether input is an async function
  • Inspects whether input is not an async function
  • Pass a test if it is not in invertion mode
  • Inverts a test
  • Returns a number range array

Matchers

  • Inspect whether input matches as string
  • Inspect whether input matches as number
  • Inspect whether input matches as array
  • Inspect whether input matches as object
  • Inspect whether input matches as boolean
  • Inspect whether input matches as regexp
  • Inspect whether input matches truthy
  • Inspect whether input matches as falsy
  • Inspect whether input matches as date
  • Inspect whether input matches as function
  • Inspect whether input matches any value

Static methods

  • Prints a string to the console
  • Fails a test
  • Enable sinon support

Static methods (Node.js only)

Examples

isAny

Inspects whether input is one of these types.
types could be string number array null object boolean true false function promise class or undefined
inspect("foo").isAny();
inspect("").isAny();
inspect(`template str`).isAny();
inspect(123).isAny();
inspect(1.23).isAny();
inspect(null).isAny();
inspect(undefined).isAny();
inspect(true).isAny();
inspect(false).isAny();
inspect(NaN).isAny();
inspect([]).isAny();
inspect({}).isAny();
inspect(/[a-z]/).isAny();
inspect(new Date()).isAny();
inspect(function() {}).isAny();
inspect(() => {}).isAny();
inspect(function* () {}).isAny();
inspect(class {}).isAny();

isNotAny

Inspects whether input is not one of any types.
types could be all what utils.getTypeOf is supporting
inspect("foo").isNotAny();
inspect("").isNotAny();
inspect(`template str`).isNotAny();
inspect(123).isNotAny();
inspect(1.23).isNotAny();
inspect(null).isNotAny();
inspect(undefined).isNotAny();
inspect(true).isNotAny();
inspect(false).isNotAny();
inspect(NaN).isNotAny();
inspect([]).isNotAny();
inspect({}).isNotAny();
inspect(/[a-z]/).isNotAny();
inspect(new Date()).isNotAny();
inspect(function fn() {}).isNotAny();
inspect(() => {}).isNotAny();
inspect(function* () {}).isNotAny();
inspect(class {}).isNotAny();

isArray

Inspects whether input is an array
inspect("foo").isArray();
inspect("").isArray();
inspect(`template str`).isArray();
inspect(123).isArray();
inspect(1.23).isArray();
inspect(null).isArray();
inspect(undefined).isArray();
inspect(true).isArray();
inspect(false).isArray();
inspect(NaN).isArray();
inspect([]).isArray();
inspect({}).isArray();
inspect(/[a-z]/).isArray();
inspect(new Date()).isArray();
inspect(function() {}).isArray();
inspect(() => {}).isArray();
inspect(function* () {}).isArray();
inspect(class {}).isArray();

isNotArray

Inspects whether input is not an array
inspect("foo").isNotArray();
inspect("").isNotArray();
inspect(`template str`).isNotArray();
inspect(123).isNotArray();
inspect(1.23).isNotArray();
inspect(null).isNotArray();
inspect(undefined).isNotArray();
inspect(true).isNotArray();
inspect(false).isNotArray();
inspect(NaN).isNotArray();
inspect([]).isNotArray();
inspect({}).isNotArray();
inspect(/[a-z]/).isNotArray();
inspect(new Date()).isNotArray();
inspect(function fn() {}).isNotArray();
inspect(() => {}).isNotArray();
inspect(function* () {}).isNotArray();
inspect(class {}).isNotArray();

isBoolean

Inspects whether input is a boolean
inspect("foo").isBoolean();
inspect("").isBoolean();
inspect(`template str`).isBoolean();
inspect(123).isBoolean();
inspect(1.23).isBoolean();
inspect(null).isBoolean();
inspect(undefined).isBoolean();
inspect(true).isBoolean();
inspect(false).isBoolean();
inspect(NaN).isBoolean();
inspect([]).isBoolean();
inspect({}).isBoolean();
inspect(/[a-z]/).isBoolean();
inspect(new Date()).isBoolean();
inspect(function() {}).isBoolean();
inspect(() => {}).isBoolean();
inspect(function* () {}).isBoolean();
inspect(class {}).isBoolean();

isNotBoolean

Inspects whether input is not a boolean
inspect("foo").isNotBoolean();
inspect("").isNotBoolean();
inspect(`template str`).isNotBoolean();
inspect(123).isNotBoolean();
inspect(1.23).isNotBoolean();
inspect(null).isNotBoolean();
inspect(undefined).isNotBoolean();
inspect(true).isNotBoolean();
inspect(false).isNotBoolean();
inspect(NaN).isNotBoolean();
inspect([]).isNotBoolean();
inspect({}).isNotBoolean();
inspect(/[a-z]/).isNotBoolean();
inspect(new Date()).isNotBoolean();
inspect(function fn() {}).isNotBoolean();
inspect(() => {}).isNotBoolean();
inspect(function* () {}).isNotBoolean();
inspect(class {}).isNotBoolean();

isTrue

Inspects whether input is true
inspect("foo").isTrue();
inspect("").isTrue();
inspect(`template str`).isTrue();
inspect(123).isTrue();
inspect(1.23).isTrue();
inspect(null).isTrue();
inspect(undefined).isTrue();
inspect(true).isTrue();
inspect(false).isTrue();
inspect(NaN).isTrue();
inspect([]).isTrue();
inspect({}).isTrue();
inspect(/[a-z]/).isTrue();
inspect(new Date()).isTrue();
inspect(function() {}).isTrue();
inspect(() => {}).isTrue();
inspect(function* () {}).isTrue();
inspect(class {}).isTrue();

isNotTrue

Inspects whether input is not === true
inspect("foo").isNotTrue();
inspect("").isNotTrue();
inspect(`template str`).isNotTrue();
inspect(123).isNotTrue();
inspect(1.23).isNotTrue();
inspect(null).isNotTrue();
inspect(undefined).isNotTrue();
inspect(true).isNotTrue();
inspect(false).isNotTrue();
inspect(NaN).isNotTrue();
inspect([]).isNotTrue();
inspect({}).isNotTrue();
inspect(/[a-z]/).isNotTrue();
inspect(new Date()).isNotTrue();
inspect(function fn() {}).isNotTrue();
inspect(() => {}).isNotTrue();
inspect(function* () {}).isNotTrue();
inspect(class {}).isNotTrue();

isFalse

Inspects whether input is false
inspect("foo").isFalse();
inspect("").isFalse();
inspect(`template str`).isFalse();
inspect(123).isFalse();
inspect(1.23).isFalse();
inspect(null).isFalse();
inspect(undefined).isFalse();
inspect(true).isFalse();
inspect(false).isFalse();
inspect(NaN).isFalse();
inspect([]).isFalse();
inspect({}).isFalse();
inspect(/[a-z]/).isFalse();
inspect(new Date()).isFalse();
inspect(function() {}).isFalse();
inspect(() => {}).isFalse();
inspect(function* () {}).isFalse();
inspect(class {}).isFalse();

isNotFalse

Inspects whether input is not false
inspect("foo").isNotFalse();
inspect("").isNotFalse();
inspect(`template str`).isNotFalse();
inspect(123).isNotFalse();
inspect(1.23).isNotFalse();
inspect(null).isNotFalse();
inspect(undefined).isNotFalse();
inspect(true).isNotFalse();
inspect(false).isNotFalse();
inspect(NaN).isNotFalse();
inspect([]).isNotFalse();
inspect({}).isNotFalse();
inspect(/[a-z]/).isNotFalse();
inspect(new Date()).isNotFalse();
inspect(function fn() {}).isNotFalse();
inspect(() => {}).isNotFalse();
inspect(function* () {}).isNotFalse();
inspect(class {}).isNotFalse();

isTruthy

Inspects whether input is truthy
This tests passes if value is not 0 "" null NaN or undefined
inspect("foo").isTruthy();
inspect("").isTruthy();
inspect(`template str`).isTruthy();
inspect(123).isTruthy();
inspect(1.23).isTruthy();
inspect(null).isTruthy();
inspect(undefined).isTruthy();
inspect(true).isTruthy();
inspect(false).isTruthy();
inspect(NaN).isTruthy();
inspect([]).isTruthy();
inspect({}).isTruthy();
inspect(/[a-z]/).isTruthy();
inspect(new Date()).isTruthy();
inspect(function() {}).isTruthy();
inspect(() => {}).isTruthy();
inspect(function* () {}).isTruthy();
inspect(class {}).isTruthy();

isFalsy

Inspects whether input is falsy
This tests passes if value is one of 0 "" null NaN or undefined
inspect("foo").isFalsy();
inspect("").isFalsy();
inspect(`template str`).isFalsy();
inspect(123).isFalsy();
inspect(1.23).isFalsy();
inspect(null).isFalsy();
inspect(undefined).isFalsy();
inspect(true).isFalsy();
inspect(false).isFalsy();
inspect(NaN).isFalsy();
inspect([]).isFalsy();
inspect({}).isFalsy();
inspect(/[a-z]/).isFalsy();
inspect(new Date()).isFalsy();
inspect(function fn() {}).isFalsy();
inspect(() => {}).isFalsy();
inspect(function* () {}).isFalsy();
inspect(class {}).isFalsy();

isClass

Inspects whether input is a class
inspect("foo").isClass();
inspect("").isClass();
inspect(`template str`).isClass();
inspect(123).isClass();
inspect(1.23).isClass();
inspect(null).isClass();
inspect(undefined).isClass();
inspect(true).isClass();
inspect(false).isClass();
inspect(NaN).isClass();
inspect([]).isClass();
inspect({}).isClass();
inspect(/[a-z]/).isClass();
inspect(new Date()).isClass();
inspect(function() {}).isClass();
inspect(() => {}).isClass();
inspect(function* () {}).isClass();
inspect(class {}).isClass();

isNotClass

Inspects whether input is not a class
inspect("foo").isNotClass();
inspect("").isNotClass();
inspect(`template str`).isNotClass();
inspect(123).isNotClass();
inspect(1.23).isNotClass();
inspect(null).isNotClass();
inspect(undefined).isNotClass();
inspect(true).isNotClass();
inspect(false).isNotClass();
inspect(NaN).isNotClass();
inspect([]).isNotClass();
inspect({}).isNotClass();
inspect(/[a-z]/).isNotClass();
inspect(new Date()).isNotClass();
inspect(function fn() {}).isNotClass();
inspect(() => {}).isNotClass();
inspect(function* () {}).isNotClass();
inspect(class {}).isNotClass();

isDate

Inspects whether input is a date object
inspect("foo").isDate();
inspect("").isDate();
inspect(`template str`).isDate();
inspect(123).isDate();
inspect(1.23).isDate();
inspect(null).isDate();
inspect(undefined).isDate();
inspect(true).isDate();
inspect(false).isDate();
inspect(NaN).isDate();
inspect([]).isDate();
inspect({}).isDate();
inspect(/[a-z]/).isDate();
inspect(new Date()).isDate();
inspect("Thu Feb 02 2017 20:18:23 GMT+0100 (CET)").isDate();
inspect(function() {}).isDate();
inspect(() => {}).isDate();
inspect(function* () {}).isDate();
inspect(class {}).isDate();

isNotDate

Inspects whether input is not a date
inspect("foo").isNotDate();
inspect("").isNotDate();
inspect(`template str`).isNotDate();
inspect(123).isNotDate();
inspect(1.23).isNotDate();
inspect(null).isNotDate();
inspect(undefined).isNotDate();
inspect(true).isNotDate();
inspect(false).isNotDate();
inspect(NaN).isNotDate();
inspect([]).isNotDate();
inspect({}).isNotDate();
inspect(/[a-z]/).isNotDate();
inspect(new Date()).isNotDate();
inspect("Thu Feb 02 2017 20:18:23 GMT+0100 (CET)").isNotDate();
inspect(function fn() {}).isNotDate();
inspect(() => {}).isNotDate();
inspect(function* () {}).isNotDate();
inspect(class {}).isNotDate();

isDateString

Inspects whether input is a date string
This can be any type of date strings.
inspect("foo").isDateString();
inspect("").isDateString();
inspect(`template str`).isDateString();
inspect(123).isDateString();
inspect(1.23).isDateString();
inspect(null).isDateString();
inspect(undefined).isDateString();
inspect(true).isDateString();
inspect(false).isDateString();
inspect(NaN).isDateString();
inspect([]).isDateString();
inspect({}).isDateString();
inspect(/[a-z]/).isDateString();
inspect(new Date()).isDateString();
inspect("Thu Feb 02 2017 20:18:23 GMT+0100 (CET)").isDateString();
inspect(function() {}).isDateString();
inspect(() => {}).isDateString();
inspect(function* () {}).isDateString();
inspect(class {}).isDateString();

isNotDateString

Inspects whether input is not a class
inspect("foo").isNotDateString();
inspect("").isNotDateString();
inspect(`template str`).isNotDateString();
inspect(123).isNotDateString();
inspect(1.23).isNotDateString();
inspect(null).isNotDateString();
inspect(undefined).isNotDateString();
inspect(true).isNotDateString();
inspect(false).isNotDateString();
inspect(NaN).isNotDateString();
inspect([]).isNotDateString();
inspect({}).isNotDateString();
inspect(/[a-z]/).isNotDateString();
inspect(new Date()).isNotDateString();
inspect("Thu Feb 02 2017 20:18:23 GMT+0100 (CET)").isNotDateString();
inspect(function fn() {}).isNotDateString();
inspect(() => {}).isNotDateString();
inspect(function* () {}).isNotDateString();
inspect(class {}).isNotDateString();

isFunction

Inspects whether input is a function
inspect("foo").isFunction();
inspect("").isFunction();
inspect(`template str`).isFunction();
inspect(123).isFunction();
inspect(1.23).isFunction();
inspect(null).isFunction();
inspect(undefined).isFunction();
inspect(true).isFunction();
inspect(false).isFunction();
inspect(NaN).isFunction();
inspect([]).isFunction();
inspect({}).isFunction();
inspect(/[a-z]/).isFunction();
inspect(new Date()).isFunction();
inspect(function() {}).isFunction();
inspect(() => {}).isFunction();
inspect(function* () {}).isFunction();
inspect(async function () {}).isFunction();
inspect(class {}).isFunction();

isNotFunction

Inspects whether input is not function
inspect("foo").isNotFunction();
inspect("").isNotFunction();
inspect(`template str`).isNotFunction();
inspect(123).isNotFunction();
inspect(1.23).isNotFunction();
inspect(null).isNotFunction();
inspect(undefined).isNotFunction();
inspect(true).isNotFunction();
inspect(false).isNotFunction();
inspect(NaN).isNotFunction();
inspect([]).isNotFunction();
inspect({}).isNotFunction();
inspect(/[a-z]/).isNotFunction();
inspect(new Date()).isNotFunction();
inspect(function fn() {}).isNotFunction();
inspect(() => {}).isNotFunction();
inspect(function* () {}).isNotFunction();
inspect(async function () {}).isNotFunction();
inspect(class {}).isNotFunction();

isGenerator

Inspects whether input is a generator function
This test will pass on environments without generator support if type of input value is function!
inspect("foo").isGenerator();
inspect("").isGenerator();
inspect(`template str`).isGenerator();
inspect(123).isGenerator();
inspect(1.23).isGenerator();
inspect(null).isGenerator();
inspect(undefined).isGenerator();
inspect(true).isGenerator();
inspect(false).isGenerator();
inspect(NaN).isGenerator();
inspect([]).isGenerator();
inspect({}).isGenerator();
inspect(/[a-z]/).isGenerator();
inspect(new Date()).isGenerator();
inspect(function() {}).isGenerator();
inspect(() => {}).isGenerator();
inspect(function* () {}).isGenerator();
inspect(async function () {}).isGenerator();
inspect(class {}).isGenerator();

isNotGenerator

Inspects whether input is not generator function
inspect("foo").isNotGenerator();
inspect("").isNotGenerator();
inspect(`template str`).isNotGenerator();
inspect(123).isNotGenerator();
inspect(1.23).isNotGenerator();
inspect(null).isNotGenerator();
inspect(undefined).isNotGenerator();
inspect(true).isNotGenerator();
inspect(false).isNotGenerator();
inspect(NaN).isNotGenerator();
inspect([]).isNotGenerator();
inspect({}).isNotGenerator();
inspect(/[a-z]/).isNotGenerator();
inspect(new Date()).isNotGenerator();
inspect(function fn() {}).isNotGenerator();
inspect(() => {}).isNotGenerator();
inspect(function* () {}).isNotGenerator();
inspect(async function () {}).isNotGenerator();
inspect(class {}).isNotGenerator();

isPromise

Inspects whether input is a promise.
A promise is identified if input type is an object and if input has a then and a catch method
inspect(Promise.resolve()).isPromise();
inspect("foo").isPromise();
inspect("").isPromise();
inspect(`template str`).isPromise();
inspect(123).isPromise();
inspect(1.23).isPromise();
inspect(null).isPromise();
inspect(undefined).isPromise();
inspect(true).isPromise();
inspect(false).isPromise();
inspect(NaN).isPromise();
inspect([]).isPromise();
inspect({}).isPromise();
inspect(/[a-z]/).isPromise();
inspect(new Date()).isPromise();
inspect(function() {}).isPromise();
inspect(() => {}).isPromise();
inspect(function* () {}).isPromise();
inspect(async function () {}).isPromise();
inspect(class {}).isPromise();

isNotPromise

Inspects whether input is not promise
inspect(Promise.resolve()).isNotPromise();
inspect("foo").isNotPromise();
inspect("").isNotPromise();
inspect(`template str`).isNotPromise();
inspect(123).isNotPromise();
inspect(1.23).isNotPromise();
inspect(null).isNotPromise();
inspect(undefined).isNotPromise();
inspect(true).isNotPromise();
inspect(false).isNotPromise();
inspect(NaN).isNotPromise();
inspect([]).isNotPromise();
inspect({}).isNotPromise();
inspect(/[a-z]/).isNotPromise();
inspect(new Date()).isNotPromise();
inspect(function fn() {}).isNotPromise();
inspect(() => {}).isNotPromise();
inspect(function* () {}).isNotPromise();
inspect(async function () {}).isNotPromise();
inspect(class {}).isNotPromise();

isAsync

Inspects whether input is an async function
inspect("foo").isAsync();
inspect("").isAsync();
inspect(`template str`).isAsync();
inspect(123).isAsync();
inspect(1.23).isAsync();
inspect(null).isAsync();
inspect(undefined).isAsync();
inspect(true).isAsync();
inspect(false).isAsync();
inspect(NaN).isAsync();
inspect([]).isAsync();
inspect({}).isAsync();
inspect(/[a-z]/).isAsync();
inspect(new Date()).isAsync();
inspect(function() {}).isAsync();
inspect(() => {}).isAsync();
inspect(function* () {}).isAsync();
inspect(async function () {}).isAsync();
inspect(class {}).isAsync();

isNotAsync

Inspects whether input is not an async function
inspect("foo").isNotAsync();
inspect("").isNotAsync();
inspect(`template str`).isNotAsync();
inspect(123).isNotAsync();
inspect(1.23).isNotAsync();
inspect(null).isNotAsync();
inspect(undefined).isNotAsync();
inspect(true).isNotAsync();
inspect(false).isNotAsync();
inspect(NaN).isNotAsync();
inspect([]).isNotAsync();
inspect({}).isNotAsync();
inspect(/[a-z]/).isNotAsync();
inspect(new Date()).isNotAsync();
inspect(function fn() {}).isNotAsync();
inspect(() => {}).isNotAsync();
inspect(function* () {}).isNotAsync();
inspect(async function () {}).isNotAsync();
inspect(class {}).isNotAsync();

isJSON

Inspects whether input is a valid JSON object
inspect("foo").isJSON();
inspect("").isJSON();
inspect(`template str`).isJSON();
inspect(123).isJSON();
inspect(1.23).isJSON();
inspect(null).isJSON();
inspect(undefined).isJSON();
inspect(true).isJSON();
inspect(false).isJSON();
inspect(NaN).isJSON();
inspect([]).isJSON();
inspect({}).isJSON();
inspect({"foo":"bar"}).isJSON();
inspect("{\"foo\":\"bar\"}").isJSON();
inspect(/[a-z]/).isJSON();
inspect(new Date()).isJSON();
inspect(function() {}).isJSON();
inspect(() => {}).isJSON();
inspect(function* () {}).isJSON();
inspect(class {}).isJSON();

isNotJSON

Inspects whether input is not a valid JSON object
inspect("foo").isNotJSON();
inspect("").isNotJSON();
inspect(`template str`).isNotJSON();
inspect(123).isNotJSON();
inspect(1.23).isNotJSON();
inspect(null).isNotJSON();
inspect(undefined).isNotJSON();
inspect(true).isNotJSON();
inspect(false).isNotJSON();
inspect(NaN).isNotJSON();
inspect([]).isNotJSON();
inspect({}).isNotJSON();
inspect({"foo":"bar"}).isNotJSON();
inspect("{\"foo\":\"bar\"}").isNotJSON();
inspect(/[a-z]/).isNotJSON();
inspect(new Date()).isNotJSON();
inspect(function fn() {}).isNotJSON();
inspect(() => {}).isNotJSON();
inspect(function* () {}).isNotJSON();
inspect(class {}).isNotJSON();

isJSONString

Inspects whether input is a valid JSON string
inspect("foo").isJSONString();
inspect("").isJSONString();
inspect(`template str`).isJSONString();
inspect(123).isJSONString();
inspect(1.23).isJSONString();
inspect(null).isJSONString();
inspect(undefined).isJSONString();
inspect(true).isJSONString();
inspect(false).isJSONString();
inspect(NaN).isJSONString();
inspect([]).isJSONString();
inspect({}).isJSONString();
inspect({"foo":"bar"}).isJSONString();
inspect("{\"foo\":\"bar\"}").isJSONString();
inspect(/[a-z]/).isJSONString();
inspect(new Date()).isJSONString();
inspect(function() {}).isJSONString();
inspect(() => {}).isJSONString();
inspect(function* () {}).isJSONString();
inspect(class {}).isJSONString();

isNotJSONString

Inspects whether input is not a valid JSON string
inspect("foo").isNotJSONString();
inspect("").isNotJSONString();
inspect(`template str`).isNotJSONString();
inspect(123).isNotJSONString();
inspect(1.23).isNotJSONString();
inspect(null).isNotJSONString();
inspect(undefined).isNotJSONString();
inspect(true).isNotJSONString();
inspect(false).isNotJSONString();
inspect(NaN).isNotJSONString();
inspect([]).isNotJSONString();
inspect({}).isNotJSONString();
inspect({"foo":"bar"}).isNotJSONString();
inspect("{\"foo\":\"bar\"}").isNotJSONString();
inspect(/[a-z]/).isNotJSONString();
inspect(new Date()).isNotJSONString();
inspect(function fn() {}).isNotJSONString();
inspect(() => {}).isNotJSONString();
inspect(function* () {}).isNotJSONString();
inspect(class {}).isNotJSONString();

isNull

Inspects whether input is null
inspect("foo").isNull();
inspect("").isNull();
inspect(`template str`).isNull();
inspect(123).isNull();
inspect(1.23).isNull();
inspect(null).isNull();
inspect(undefined).isNull();
inspect(true).isNull();
inspect(false).isNull();
inspect(NaN).isNull();
inspect([]).isNull();
inspect({}).isNull();
inspect(/[a-z]/).isNull();
inspect(new Date()).isNull();
inspect(function() {}).isNull();
inspect(() => {}).isNull();
inspect(function* () {}).isNull();
inspect(class {}).isNull();

isNotNull

Inspects whether input is not null
inspect("foo").isNotNull();
inspect("").isNotNull();
inspect(`template str`).isNotNull();
inspect(123).isNotNull();
inspect(1.23).isNotNull();
inspect(null).isNotNull();
inspect(undefined).isNotNull();
inspect(true).isNotNull();
inspect(false).isNotNull();
inspect(NaN).isNotNull();
inspect([]).isNotNull();
inspect({}).isNotNull();
inspect(/[a-z]/).isNotNull();
inspect(new Date()).isNotNull();
inspect(function fn() {}).isNotNull();
inspect(() => {}).isNotNull();
inspect(function* () {}).isNotNull();
inspect(class {}).isNotNull();

isNumber

Inspects whether input is a number
inspect("foo").isNumber();
inspect("").isNumber();
inspect(`template str`).isNumber();
inspect(123).isNumber();
inspect(1.23).isNumber();
inspect(null).isNumber();
inspect(undefined).isNumber();
inspect(true).isNumber();
inspect(false).isNumber();
inspect(NaN).isNumber();
inspect([]).isNumber();
inspect({}).isNumber();
inspect(/[a-z]/).isNumber();
inspect(new Date()).isNumber();
inspect(function() {}).isNumber();
inspect(() => {}).isNumber();
inspect(function* () {}).isNumber();
inspect(class {}).isNumber();

isNotNumber

Inspects whether input is not a number
inspect("foo").isNotNumber();
inspect("").isNotNumber();
inspect(`template str`).isNotNumber();
inspect(123).isNotNumber();
inspect(1.23).isNotNumber();
inspect(null).isNotNumber();
inspect(undefined).isNotNumber();
inspect(true).isNotNumber();
inspect(false).isNotNumber();
inspect(NaN).isNotNumber();
inspect([]).isNotNumber();
inspect({}).isNotNumber();
inspect(/[a-z]/).isNotNumber();
inspect(new Date()).isNotNumber();
inspect(function fn() {}).isNotNumber();
inspect(() => {}).isNotNumber();
inspect(function* () {}).isNotNumber();
inspect(class {}).isNotNumber();

isNaN

Inspects whether input is NaN
inspect("foo").isNaN();
inspect("").isNaN();
inspect(`template str`).isNaN();
inspect(123).isNaN();
inspect(1.23).isNaN();
inspect(null).isNaN();
inspect(undefined).isNaN();
inspect(true).isNaN();
inspect(false).isNaN();
inspect(NaN).isNaN();
inspect([]).isNaN();
inspect({}).isNaN();
inspect(/[a-z]/).isNaN();
inspect(new Date()).isNaN();
inspect(function() {}).isNaN();
inspect(() => {}).isNaN();
inspect(function* () {}).isNaN();
inspect(class {}).isNaN();

isNotNaN

Inspects whether input is not a NaN
inspect("foo").isNotNaN();
inspect("").isNotNaN();
inspect(`template str`).isNotNaN();
inspect(123).isNotNaN();
inspect(1.23).isNotNaN();
inspect(null).isNotNaN();
inspect(undefined).isNotNaN();
inspect(true).isNotNaN();
inspect(false).isNotNaN();
inspect(NaN).isNotNaN();
inspect([]).isNotNaN();
inspect({}).isNotNaN();
inspect(/[a-z]/).isNotNaN();
inspect(new Date()).isNotNaN();
inspect(function fn() {}).isNotNaN();
inspect(() => {}).isNotNaN();
inspect(function* () {}).isNotNaN();
inspect(class {}).isNotNaN();

isObject

Inspects whether input is an object
inspect("foo").isObject();
inspect("").isObject();
inspect(`template str`).isObject();
inspect(123).isObject();
inspect(1.23).isObject();
inspect(null).isObject();
inspect(undefined).isObject();
inspect(true).isObject();
inspect(false).isObject();
inspect(NaN).isObject();
inspect([]).isObject();
inspect({}).isObject();
inspect(/[a-z]/).isObject();
inspect(new Date()).isObject();
inspect(function() {}).isObject();
inspect(() => {}).isObject();
inspect(function* () {}).isObject();
inspect(class {}).isObject();

isNotObject

Inspects whether input is not an object
inspect("foo").isNotObject();
inspect("").isNotObject();
inspect(`template str`).isNotObject();
inspect(123).isNotObject();
inspect(1.23).isNotObject();
inspect(null).isNotObject();
inspect(undefined).isNotObject();
inspect(true).isNotObject();
inspect(false).isNotObject();
inspect(NaN).isNotObject();
inspect([]).isNotObject();
inspect({}).isNotObject();
inspect(/[a-z]/).isNotObject();
inspect(new Date()).isNotObject();
inspect(function fn() {}).isNotObject();
inspect(() => {}).isNotObject();
inspect(function* () {}).isNotObject();
inspect(class {}).isNotObject();

isRegExp

Inspects whether input is a regexp
inspect("foo").isRegExp();
inspect("").isRegExp();
inspect(`template str`).isRegExp();
inspect(123).isRegExp();
inspect(1.23).isRegExp();
inspect(null).isRegExp();
inspect(undefined).isRegExp();
inspect(true).isRegExp();
inspect(false).isRegExp();
inspect(NaN).isRegExp();
inspect([]).isRegExp();
inspect({}).isRegExp();
inspect(/[a-z]/).isRegExp();
inspect(new Date()).isRegExp();
inspect(function() {}).isRegExp();
inspect(() => {}).isRegExp();
inspect(function* () {}).isRegExp();
inspect(class {}).isRegExp();

isNotRegExp

Inspects whether input is not a regexp
inspect("foo").isNotRegExp();
inspect("").isNotRegExp();
inspect(`template str`).isNotRegExp();
inspect(123).isNotRegExp();
inspect(1.23).isNotRegExp();
inspect(null).isNotRegExp();
inspect(undefined).isNotRegExp();
inspect(true).isNotRegExp();
inspect(false).isNotRegExp();
inspect(NaN).isNotRegExp();
inspect([]).isNotRegExp();
inspect({}).isNotRegExp();
inspect(/[a-z]/).isNotRegExp();
inspect(new Date()).isNotRegExp();
inspect(function fn() {}).isNotRegExp();
inspect(() => {}).isNotRegExp();
inspect(function* () {}).isNotRegExp();
inspect(class {}).isNotRegExp();

isString

Inspects whether input is a string
inspect("foo").isString();
inspect("").isString();
inspect(`template str`).isString();
inspect(123).isString();
inspect(1.23).isString();
inspect(null).isString();
inspect(undefined).isString();
inspect(true).isString();
inspect(false).isString();
inspect(NaN).isString();
inspect([]).isString();
inspect({}).isString();
inspect(/[a-z]/).isString();
inspect(new Date()).isString();
inspect(function() {}).isString();
inspect(() => {}).isString();
inspect(function* () {}).isString();
inspect(class {}).isString();

isNotString

Inspects whether input is not a string
inspect("foo").isNotString();
inspect("").isNotString();
inspect(`template str`).isNotString();
inspect(123).isNotString();
inspect(1.23).isNotString();
inspect(null).isNotString();
inspect(undefined).isNotString();
inspect(true).isNotString();
inspect(false).isNotString();
inspect(NaN).isNotString();
inspect([]).isNotString();
inspect({}).isNotString();
inspect(/[a-z]/).isNotString();
inspect(new Date()).isNotString();
inspect(function() {}).isNotString();
inspect(() => {}).isNotString();
inspect(function* () {}).isNotString();
inspect(class {}).isNotString();

isEmpty

Inspects whether input is empty
This tests passes if value is one of "" [] or {}
inspect("foo").isEmpty();
inspect("").isEmpty();
inspect(`template str`).isEmpty();
inspect(123).isEmpty();
inspect(1.23).isEmpty();
inspect(null).isEmpty();
inspect(undefined).isEmpty();
inspect(true).isEmpty();
inspect(false).isEmpty();
inspect(NaN).isEmpty();
inspect([]).isEmpty();
inspect({}).isEmpty();
inspect(/[a-z]/).isEmpty();
inspect(new Date()).isEmpty();
inspect(function() {}).isEmpty();
inspect(() => {}).isEmpty();
inspect(function* () {}).isEmpty();
inspect(class {}).isEmpty();

isNotEmpty

Inspects whether input is not empty
This tests passes if value is other than "" [] or {}
inspect("foo").isNotEmpty();
inspect("").isNotEmpty();
inspect(`template str`).isNotEmpty();
inspect(123).isNotEmpty();
inspect(1.23).isNotEmpty();
inspect(null).isNotEmpty();
inspect(undefined).isNotEmpty();
inspect(true).isNotEmpty();
inspect(false).isNotEmpty();
inspect(NaN).isNotEmpty();
inspect([]).isNotEmpty();
inspect({}).isNotEmpty();
inspect(/[a-z]/).isNotEmpty();
inspect(new Date()).isNotEmpty();
inspect(function fn() {}).isNotEmpty();
inspect(() => {}).isNotEmpty();
inspect(function* () {}).isNotEmpty();
inspect(class {}).isNotEmpty();

isUndefined

Inspects whether input is undefined
inspect("foo").isUndefined();
inspect("").isUndefined();
inspect(`template str`).isUndefined();
inspect(123).isUndefined();
inspect(1.23).isUndefined();
inspect(null).isUndefined();
inspect(undefined).isUndefined();
inspect(true).isUndefined();
inspect(false).isUndefined();
inspect(NaN).isUndefined();
inspect([]).isUndefined();
inspect({}).isUndefined();
inspect(/[a-z]/).isUndefined();
inspect(new Date()).isUndefined();
inspect(function() {}).isUndefined();
inspect(() => {}).isUndefined();
inspect(function* () {}).isUndefined();
inspect(class {}).isUndefined();

isNotUndefined

Inspects whether input is not undefined
inspect("foo").isNotUndefined();
inspect("").isNotUndefined();
inspect(`template str`).isNotUndefined();
inspect(123).isNotUndefined();
inspect(1.23).isNotUndefined();
inspect(null).isNotUndefined();
inspect(undefined).isNotUndefined();
inspect(true).isNotUndefined();
inspect(false).isNotUndefined();
inspect(NaN).isNotUndefined();
inspect([]).isNotUndefined();
inspect({}).isNotUndefined();
inspect(/[a-z]/).isNotUndefined();
inspect(new Date()).isNotUndefined();
inspect(function fn() {}).isNotUndefined();
inspect(() => {}).isNotUndefined();
inspect(function* () {}).isNotUndefined();
inspect(class {}).isNotUndefined();

doesFileExists

Inspects whether a file exists
inspect("./fixtures/test.json").doesFileExists();
inspect("./fixtures/notExists.json").doesFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").doesFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").doesFileExists();
inspect("./fixtures/").doesFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/").doesFileExists();
inspect("./fixtures-notexists/").doesFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures-notexists/").doesFileExists();

doesNotFileExists

Inspects whether a file not exists
inspect("./fixtures/test.json").doesNotFileExists();
inspect("./fixtures/notExists.json").doesNotFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").doesNotFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").doesNotFileExists();
inspect("./fixtures/").doesNotFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/").doesNotFileExists();
inspect("./fixtures-notexists/").doesNotFileExists();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures-notexists/").doesNotFileExists();

isDirectory

Inspects whether a file exists and it is a directory
inspect("./fixtures/test.json").isDirectory();
inspect("./fixtures/notExists.json").isDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").isDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").isDirectory();
inspect("./fixtures/").isDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/").isDirectory();
inspect("./fixtures-notexists/").isDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures-notexists/").isDirectory();

isNotDirectory

Inspects whether a file/dir does not exists or it is not a directory
inspect("./fixtures/test.json").isNotDirectory();
inspect("./fixtures/notExists.json").isNotDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").isNotDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").isNotDirectory();
inspect("./fixtures/").isNotDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/").isNotDirectory();
inspect("./fixtures-notexists/").isNotDirectory();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures-notexists/").isNotDirectory();

isFile

Inspects whether a file exists and it is a file
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").isFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").isFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").isFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").isFile();
inspect("./fixtures/").isFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/").isFile();
inspect("./fixtures-notexists/").isFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures-notexists/").isFile();

isNotFile

Inspects whether a file does not exists or it is not a file
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").isNotFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").isNotFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").isNotFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").isNotFile();
inspect("./fixtures/").isNotFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/").isNotFile();
inspect("./fixtures-notexists/").isNotFile();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures-notexists/").isNotFile();

fileContains

Inspect whether a file contains a certain content
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").fileContains();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").fileContains();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").fileContains();

fileNotContains

Inspect whether a file contains a certain content
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").fileNotContains();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/test.json").fileNotContains();
inspect("/home/andi/Projects/InspectJS/inspectjs/tests/fixtures/notExists.json").fileNotContains();

No examples added yet!

This method hasn't any examples yet, sorry!
require(`./examples/${methodName}`);