Docs ยป Examples
Type comparison
isString(message) v1.0.0
Inspects whether input is a string isNotString(message) v1.0.0
Inspects whether input is not a string isNumber(message) v1.0.0
Inspects whether input is a number isNotNumber(message) v1.0.0
Inspects whether input is not a number isObject(message) v1.0.0
Inspects whether input is an object isNotObject(message) v1.0.0
Inspects whether input is not an object isArray(message) v1.0.0
Inspects whether input is an array isNotArray(message) v1.0.0
Inspects whether input is not an array isFunction(message) v1.0.0
Inspects whether input is a function isNotFunction(message) v1.0.0
Inspects whether input is not function isClass(message) v1.1.0
Inspects whether input is a class isNotClass(message) v1.1.0
Inspects whether input is not a class isGenerator(message) v1.0.0
Inspects whether input is a generator function
This test will pass on environments without generator support if type of input value isfunction
!isNotGenerator(message) v1.0.0
Inspects whether input is not generator function isPromise(message) v1.0.0
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 methodisNotPromise(message) v1.0.0
Inspects whether input is not promise isRegExp(message) v1.0.0
Inspects whether input is a regexp isNotRegExp(message) v1.0.0
Inspects whether input is not a regexp isDate(message) v1.2.0
Inspects whether input is a date object isNotDate(message) v1.2.0
Inspects whether input is not a date isDateString(message) v1.2.0
Inspects whether input is a date string
This can be any type of date strings.isNotDateString(message) v1.2.0
Inspects whether input is not a class isBoolean(message) v1.0.0
Inspects whether input is a boolean isNotBoolean(message) v1.0.0
Inspects whether input is not a boolean isNaN(message) v1.0.0
Inspects whether input is NaN isNotNaN(message) v1.0.0
Inspects whether input is not a NaN isAny(types, message) v1.0.0
Inspects whether input is one of these types
.types
could bestring
number
array
null
object
boolean
true
false
function
promise
class
orundefined
isNotAny(types, message) v1.0.0
Inspects whether input is not one of any types. types
could be all whatutils.getTypeOf
is supportingisInstanceOf(proto, message) v1.0.0
Inspects whether input is an instance of a specific prototype or class isNotInstanceOf(proto, message) v1.0.0
Inspects whether input is not an instance of a specific prototype or class isJSON(message) v1.4.0
Inspects whether input is a valid JSON object isNotJSON(message) v1.4.0
Inspects whether input is not a valid JSON object isJSONString(message) v1.4.1
Inspects whether input is a valid JSON string isNotJSONString(message) v1.4.1
Inspects whether input is not a valid JSON string
Value existance
isEmpty(message) v1.0.0
Inspects whether input is empty
This tests passes if value is one of""
[]
or{}
isNotEmpty(message) v1.0.0
Inspects whether input is not empty
This tests passes if value is other than""
[]
or{}
hasMethod(name, message) v1.3.0
Inspects whether input has a specific method hasNotMethod(name, message) v1.3.0
Inspects whether input has not a specific method hasKey(key, message) v1.0.0
Inspects whether input
has a specific keyhasNotKey(key, message) v1.0.0
Inspects whether input
doesn't has a specific keyhasKeys(keys, message) v1.0.0
Inspects whether input
has all of this keyshasNotKeys(keys, message) v1.0.0
Inspects whether input
has none of this keyshasAnyKeys(keys, message) v1.0.0
Inspects whether input
has any of these keyshasNotAnyKeys(keys, message) v1.0.0
Inspects whether input
should not has any of these keyshasProp(props, message) v1.0.0
Inspects whether input
has a property with a specified valuehasNotProp(props, message) v1.0.0
Inspects whether input
has not a property with a specified valuehasProps(props, message) v1.0.0
Inspects whether input
has all of this propertieshasNotProps(props, message) v1.0.0
Inspects whether input
has none of these propertieshasLength(len, message) v1.0.0
Inspects whether input has a specific length
Accepts arrays or strings as input valueshasNotLength(len, message) v1.0.0
Inspects whether input has not a specific length
Accepts arrays or strings as input valueshasMinLength(len, message) v1.0.0
Inspects whether input has a specific min length
Accepts arrays or strings as input valueshasMaxLength(len, message) v1.0.0
Inspects whether input has a specific max length
Accepts arrays or strings as input valueshasValue(arg, message) v1.0.0
Inspects whether an array has a specific value hasNotValue(arg, message) v1.0.0
Inspects whether an array has not a specific value isInheritedBy(obj, message) v1.3.0
Inspects whether input has been inherited by a specific object isNotInheritedBy(obj, message) v1.3.0
Inspects whether input has not been inherited by a specific object
Value comparison
isEql(value, message) v1.0.0
Inspects whether input is eql to a value.
This makes a value comparison.isNotEql(value, message) v1.0.0
Inspects whether input is not eql to a value.
This makes a value comparison.isEqual(value, message) v1.0.0
Inspects whether input is equal to a value.
This makes a === comparisonisNotEqual(value, message) v1.0.0
Inspects whether input is not equal to a value.
This makes a !== comparisonisTrue(message) v1.0.0
Inspects whether input is true isNotTrue(message) v1.0.0
Inspects whether input is not === true isFalse(message) v1.0.0
Inspects whether input is false isNotFalse(message) v1.0.0
Inspects whether input is not false isTruthy(message) v1.0.0
Inspects whether input is truthy
This tests passes if value is not0
""
null
NaN
orundefined
isFalsy(message) v1.0.0
Inspects whether input is falsy
This tests passes if value is one of0
""
null
NaN
orundefined
isNull(message) v1.0.0
Inspects whether input is null isNotNull(message) v1.0.0
Inspects whether input is not null isUndefined(message) v1.0.0
Inspects whether input is undefined isNotUndefined(message) v1.0.0
Inspects whether input is not undefined doesMatch(reg, message) v1.0.0
Inspects whether input matches against a regular expression doesNotMatch(reg, message) v1.0.0
Inspects whether input does not matche against a regular expression doesStartWith(match, message) v1.0.0
Inspects whether input starts with a specific string doesNotStartWith(match, message) v1.0.0
Inspects whether input starts not with a specific string doesEndWith(match, message) v1.0.0
Inspects whether input ends with a specific string doesNotEndWith(match, message) v1.0.0
Inspects whether input ends not with a specific string isGreaterThan(num, message) v1.0.0
Inspects whether a number is greater than value isGreaterOrEqual(num, message) v1.0.0
Inspects whether input
is greater than or equal tonum
isLesserThan(num, message) v1.0.0
Inspects whether input
is lesser thannum
isLesserOrEqual(num, message) v1.0.0
Inspects whether input
is lesser than or equal tonum
doesContain(str, message) v1.0.0
Inspects whether a string contains a specific value doesNotContain(str, message) v1.0.0
Inspects whether a string does not contains a specific value doesContainOnce(str, message) v1.0.0
Inspects whether a string contains a specific value only once hasValues(arg, message) v1.0.0
Inspects whether an array has all of these value(s) hasNotValues(arg, message) v1.0.0
Inspects whether an array has none of these values hasAnyValues(values, message) v1.0.0
Inspects whether an array has any of these values hasNotAnyValues(values, message) v1.0.0
Inspects whether an array has not any of these values isWithin(min, max, message) v1.0.0
Inspects whether a number is within a specivic range isNotWithin(min, max, message) v1.0.0
Inspects whether a number is not within a specivic range hasSubset(subset, message) v1.0.0
Inspects whether an array contains a subset of an array in the same order hasNotSubset(subset, message) v1.0.0
Inspects whether an array does not contains a subset of an array in the same order isCloseTo(num, range, message) v1.0.0
Inspects whether a number is close to num by a given range isNotCloseTo(num, range, message) v1.0.0
Inspects whether a number is close to num by a given range
Behavior testing
doesThrow(exception, message) v1.0.0
Inspects whether a function throws an exception doesNotThrow(exception, message) v1.0.0
Inspects whether a function does not throw an exception doesIncrease(prop, num, message) v1.0.0
Inspects whether an function call increases a property doesDecrease(prop, num, message) v1.0.0
Inspects whether an function call decreases a property doesChange(prop, message) v1.0.0
Inspects whether an function call changes a property doesNotChange(prop, prop, message) v1.0.0
Inspects whether an function call does not change a property onCall(fn) v1.0.0
Cals a function withArgs() v1.0.0
Calls input as a function with args withArgsOn(ctx, ) v1.0.0
Calls input as a function with args
Node.js extras
doesFileExists(file, message) v1.6.0
Inspects whether a file exists doesNotFileExists(file, message) v1.6.0
Inspects whether a file not exists isFile(file, message) v1.6.0
Inspects whether a file exists and it is a file isNotFile(file, message) v1.6.0
Inspects whether a file does not exists or it is not a file isDirectory(file, message) v1.6.0
Inspects whether a file exists and it is a directory isNotDirectory(file, message) v1.6.0
Inspects whether a file/dir does not exists or it is not a directory fileContains(search, message) v1.8.0
Inspect whether a file contains a certain content fileNotContains(search, message) v1.8.0
Inspect whether a file contains a certain content
Misc
toString(value) v1.0.0
Converts a value in a readable value getItem(index) v1.4.0
Returns an array element by a given index isAsync(message) v1.7.0
Inspects whether input is an async function isNotAsync(message) v1.7.0
Inspects whether input is not an async function pass() v1.6.0
Pass a test if it is not in invertion mode invert(value) v1.6.0
Inverts a test getRange(from, to) v1.5.0
Returns a number range array
Matchers
matcher.str v1.2.0
Inspect whether input matches as string matcher.num v1.2.0
Inspect whether input matches as number matcher.arr v1.2.0
Inspect whether input matches as array matcher.obj v1.2.0
Inspect whether input matches as object matcher.bool v1.2.0
Inspect whether input matches as boolean matcher.regexp v1.2.0
Inspect whether input matches as regexp matcher.truthy v1.2.0
Inspect whether input matches truthy matcher.falsy v1.2.0
Inspect whether input matches as falsy matcher.date v1.2.0
Inspect whether input matches as date matcher.func v1.2.0
Inspect whether input matches as function matcher.any v1.2.0
Inspect whether input matches any value
Static methods
print(str) v1.0.0
Prints a string to the console fail(message, actual, expected) v1.0.0
Fails a test useSinon(sinon) v1.0.0
Enable sinon support
Static methods (Node.js only)
Examples
isAny
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
types
could be all what utils.getTypeOf
is supportinginspect("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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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("/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("/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!
require(`./examples/${methodName}`);