Types

Types checks.

Methods

(inner) argument(value) → {boolean}

Check if is an arguments

Interfaces: all, any, not

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

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) boolean(value) → {boolean}

Check if is valid boolean

Interfaces: all, any, not

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

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

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

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

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

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) empty(value) → {boolean}

Check if is empty

Interfaces: all, any, not

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

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

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

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) function(value) → {boolean}

Check if is a function

Interfaces: all, any, not

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) iterable(value) → {boolean}

Check if is iterable

Interfaces: all, any, not

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

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) null(value) → {boolean}

Check if is null

Interfaces: all, any, not

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

Source:
Parameters:
Name Type Description
value Mixed

value

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

(inner) primitive(value) → {boolean}

Check if is a primitive object

Interfaces: all, any, not

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

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

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

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) string(value) → {boolean}

Check if is valid string

Interfaces: all, any, not

Source:
Parameters:
Name Type Description
value Mixed

value

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

(inner) true(value) → {boolean}

Check if is true boolean type

Interfaces: all, any, not

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

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) undefined(value) → {boolean}

Check if is undefined value

Interfaces: all, any, not

Source:
Parameters:
Name Type Description
value Mixed

value

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