@svizzle/utils/array-boolean

Methods

(static) areAllTruthy(array) → {boolean}

Source:
Since:
  • 0.1.0

Return true if all elements of the provided array are truthy

Example
> areAllTruthy([true, true])
true
> areAllTruthy([1, [], [1, 2], {}, {a: 1}, 'a'])
true
> areAllTruthy([false, true])
false
> areAllTruthy([0, {a: 1}])
false
> areAllTruthy(['', {a: 1}])
false
Parameters:
Name Type Description
array array
Returns:
Type
boolean

(static) areEqual(array) → {boolean}

Source:
Since:
  • 0.21.0
See:

Return true if items in the provided array are equal

Example
> areEqual([false, false, false])
true
> areEqual([true, false, false])
false
> areEqual([1, 1, 2])
false
> areEqual([{a: 1}, {a: 1}, {a: 1}])
true
> areEqual([[0], {a: 1}, 7])
false
> areEqual([[1, 2], [1, 2], [1, 2]])
true
> areEqual([
	{a: [1, {a: [1, 2]}]},
	{a: [1, {a: [1, 2]}]},
	{a: [1, {a: [1, 2]}]}
])
true
> areEqual([])
false
> areEqual([1])
false
Parameters:
Name Type Description
array array
Returns:
Type
boolean

(static) areSomeTruthy(array) → {boolean}

Source:
Since:
  • 0.1.0

Return true if some elements of the provided array are truthy

Example
> areSomeTruthy([false, true])
true
> areSomeTruthy([0, false, []])
true
> areSomeTruthy([0, false, [1, 2]])
true
> areSomeTruthy([0, false, {}])
true
> areSomeTruthy([0, false, {a: 1}])
true
> areSomeTruthy([0, false, 'a'])
true
> areSomeTruthy([0, ''])
> false
Parameters:
Name Type Description
array array
Returns:
Type
boolean