Returns true if all value in needles is contained in haystack, by default using === semantics.
needles
haystack
const a = ['apples','oranges','pears','mandarins'];const b = ['pears', 'apples'];contains(a, b); // Trueconst c = ['pears', 'bananas'];contains(a, b); // False ('bananas' does not exist in a) Copy
const a = ['apples','oranges','pears','mandarins'];const b = ['pears', 'apples'];contains(a, b); // Trueconst c = ['pears', 'bananas'];contains(a, b); // False ('bananas' does not exist in a)
If needles is empty, contains will return true.
contains
Compare by value using ixfx's isEqualValueDefault, or a custom function of your own
contains(a, b, isEqualValueDefault);contains(a, b, (valueA, valueV) => { return valueA.name === valueB.name}) Copy
contains(a, b, isEqualValueDefault);contains(a, b, (valueA, valueV) => { return valueA.name === valueB.name})
Array to search
Things to look for
Optional function to compare equality. By default uses === semantics
If parameters are not valid
Returns true if all value in
needlesis contained inhaystack, by default using === semantics.If
needlesis empty,containswill return true.Compare by value using ixfx's isEqualValueDefault, or a custom function of your own