Types

Types checks.

Methods

(inner) argument(value) → {boolean}

Check if is an arguments

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.argument(arguments) // true
be.argument({}) // false

(inner) array(value) → {boolean}

Check if is an array

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.array([1, 2, 3]) // true
be.array({a: 1, b: 2}) // false

(inner) asyncFunction(value) → {boolean}

Check if is async Function

Interfaces: all, any, not, err

Since:
  • 1.6.3
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.asyncFunction(async function test(){}) // true

(inner) boolean(value) → {boolean}

Check if is valid boolean

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.boolean(false) // true
be.boolean('true') // false

(inner) booleanFalse(value) → {boolean}

Alias of be.false

Interfaces: all, any, not, err

Since:
  • 1.3.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.booleanFalse(false) // true
be.booleanFalse(true) // false

(inner) booleanTrue(value) → {boolean}

Alias of be.true

Interfaces: all, any, not, err

Since:
  • 1.3.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.booleanTrue(true) // true
be.booleanTrue(false) // false

(inner) buffer(value) → {boolean}

Check if is a buffer

Interfaces: all, any, not, err

Since:
  • 1.3.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
var b = new Buffer('hello');
be.buffer(b) // true

(inner) classOf(object, className) → {boolean}

Check [object ?] class

Interfaces: not, err

Source:
Parameters:
Name Type Description
object Mixed

object

className string

class name

Returns:
Type:
boolean
Example
be.classOf(2, 'number') // true
be.classOf([1, 2, 3], 'array') // true
be.classOf({a: 1, b: 2}, 'object') // true
be.classOf({a: 1, b: 2}, 'array') // false
be.classOf(/hello/, 'regexp') // true
be.classOf(true, 'boolean') // true

(inner) date(value) → {boolean}

Check if is date object

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

date object

Returns:
Type:
boolean
Example
be.date(new Date()) // true
be.date('2017-12-25') // false

(inner) defined(value) → {boolean}

Check if is defined

Interfaces: all, any, not, err

Since:
  • 1.4.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
var param = 'hello';
be.defined(param) // true
var param2;
be.defined(param2) // false

(inner) empty(value) → {boolean}

Check if is empty

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.empty('') // true
be.empty(' ') // false
be.empty({}) // true
be.empty([]) // true

(inner) error(value) → {boolean}

Check if is an error object

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.error(new Error('my error')) // true
be.error({}) // false

(inner) false(value) → {boolean}

Check if is false boolean type

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.booleanFalse(false) // true
be.booleanFalse(true) // false

(inner) falsy(value) → {boolean}

Check if a falsy value https://developer.mozilla.org/it/docs/Glossary/Falsy Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.falsy(false) // true
be.falsy(null) // true
be.falsy() // true
be.falsy(0) // true
be.falsy(true) // false

(inner) float32Array(value) → {boolean}

Check if is Float32Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.float32Array(new Float32Array()) // true

(inner) float64Array(value) → {boolean}

Check if is Float64Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.float64Array(new Float64Array()) // true

(inner) function(value) → {boolean}

Check if is a function

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.function(function(){return 1 + 2}) // true
be.function(new Date()) // false

(inner) generatorFunction(value) → {boolean}

Check if is GeneratorFunction

Interfaces: all, any, not, err

Since:
  • 1.10.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.generatorFunction(function* test(){}) // true

(inner) int8Array(value) → {boolean}

Check if is Int8Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.int8Array(new Int8Array()) // true

(inner) int16Array(value) → {boolean}

Check if is Int16Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.int16Array(new Int16Array()) // true

(inner) int32Array(value) → {boolean}

Check if is Int32Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.int32Array(new Int32Array()) // true

(inner) iterable(value) → {boolean}

Check if is iterable

Interfaces: all, any, not, err

Since:
  • 1.3.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.iterable([1, 2, 3]) // true
be.iterable('hello') // true
be.iterable({a: 1}) // false

(inner) json(value) → {boolean}

Check if is a JSON string

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

json string

Returns:
Type:
boolean
Example
be.json('{"a": 1, "b": 2}') // true
be.json({a: 1, b: 2}) // false

(inner) map(value) → {boolean}

Check if is Map object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.map(new Map()) // true

(inner) mapIterator(value) → {boolean}

Check if is Map Iterator object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.mapIterator(new Map().values()) // true

(inner) nil(value) → {boolean}

Check if is null or undefined

Interfaces: all, any, not, err

Since:
  • 1.12.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.nil(null) // true
be.nil(undefined) // true

(inner) null(value) → {boolean}

Check if is null

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.null(null) // true
be.null(undefined) // false

(inner) number(value) → {boolean}

Check if is valid number

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.number(1) // true
be.number(false) // false

(inner) of(object, className) → {boolean}

Check type of (alias of classOf)

Interfaces: not, err

Since:
  • 1.11.0
Source:
Parameters:
Name Type Description
object Mixed

object

className string

class name

Returns:
Type:
boolean
Example
be.of(2, 'number') // true
be.of([1, 2, 3], 'array') // true
be.of({a: 1, b: 2}, 'object') // true
be.of({a: 1, b: 2}, 'array') // false
be.of(/hello/, 'regexp') // true
be.of(true, 'boolean') // true

(inner) primitive(value) → {boolean}

Check if is a primitive object

Interfaces: all, any, not, err

Since:
  • 1.3.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.primitive(20) // true
be.primitive(new Number(20)) // false

(inner) promise(value) → {boolean}

Check if is a primitive object

Interfaces: all, any, not, err

Since:
  • 1.3.1
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
var p = new Promise((resolve, reject) => {resolve()});
be.promise(p) // true

(inner) regexp(value) → {boolean}

Check if is a valid RegExp

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.regexp(/hello/) // true
be.regexp('hello') // false
be.regexp(new RegExp(/hello/)) // true

(inner) sameType(value, other) → {boolean}

Check if both arguments are same type

Interfaces: not, err

Source:
Parameters:
Name Type Description
value Mixed

first

other Mixed

second

Returns:
Type:
boolean
Example
be.sameType(1, 1) // true
be.sameType(1, '1') // false

(inner) set(value) → {boolean}

Check if is Set object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.set(new Set()) // true

(inner) setIterator(value) → {boolean}

Check if is Set Iterator object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.setIterator(new Set().values()) // true

(inner) string(value) → {boolean}

Check if is valid string

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.string('hello') // true
be.string(false) // false

(inner) symbol(value) → {boolean}

Check if is symbol

Interfaces: all, any, not, err

Since:
  • 1.4.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.symbol(Symbol('hello')) // true
be.symbol({a: 1}) // false

(inner) true(value) → {boolean}

Check if is true boolean type

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.booleanTrue(true) // true
be.booleanTrue(false) // false

(inner) truthy(value) → {boolean}

Check if a truthy value https://developer.mozilla.org/en-US/docs/Glossary/Truthy Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed
Returns:
Type:
boolean
Example
be.truthy('hello') // true
be.truthy({}) // true
be.truthy([]) // true
be.truthy(2) // true
be.truthy(false) // false
be.truthy(null) // false
be.truthy(undefined) // false

(inner) uint8Array(value) → {boolean}

Check if is Uint8Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.uint8Array(new Uint8Array()) // true

(inner) uint8ClampedArray(value) → {boolean}

Check if is Uint8ClampedArray object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.uint8ClampedArray(new Uint8ClampedArray()) // true

(inner) uint16Array(value) → {boolean}

Check if is Uint16Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.uint16Array(new Uint16Array()) // true

(inner) uint32Array(value) → {boolean}

Check if is Uint32Array object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.uint32Array(new Uint32Array()) // true

(inner) undefined(value) → {boolean}

Check if is undefined value

Interfaces: all, any, not, err

Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.undefined(undefined) // true
be.undefined(null) // false

(inner) weakMap(value) → {boolean}

Check if is WeakMap object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.weakMap(new WeakMap()) // true

(inner) weakSet(value) → {boolean}

Check if is WeakSet object

Interfaces: all, any, not, err

Since:
  • 1.5.0
Source:
Parameters:
Name Type Description
value Mixed

value

Returns:
Type:
boolean
Example
be.weakSet(new WeakSet()) // true