## Arrays diff Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
jkeks
Posts: 33
Joined: 20 Oct 2019, 00:24
Contact:

### Arrays diff

Hello !
Is there array difference lib or ready functions for compare arrays ?
mikeyww
Posts: 4145
Joined: 09 Sep 2014, 18:38

### Re: Arrays diff

Yes. It is called bigA.
Chunjee
Posts: 754
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

### Re: Arrays diff  Topic is solved

bigA can make working with arrays easier. For example.

https://biga-ahk.github.io/biga.ahk/#/?id=difference
Creates an array of array values not included in the other given arrays. The order and references of result values are determined by the first array.

Code: Select all

``````A := new biga() ; requires https://www.npmjs.com/package/biga.ahk

A.difference([2, 1], [2, 3])
; => [1]

A.difference([2, 1], [3])
; => [2, 1]

A.difference([2, 1], 3)
; => [2, 1]``````

or find what two (or more) arrays have in common:

https://biga-ahk.github.io/biga.ahk/#/?id=intersection
Creates an array of unique values that are included in all given arrays. The order and references of result values are determined by the first array.

Code: Select all

``````A.intersection([2, 1], [2, 3])
; => [2]
``````

You can also check if two arrays match keys and values:

https://biga-ahk.github.io/biga.ahk/#/?id=isequal
Performs a deep comparison between values to determine if they are equivalent.
This method supports comparing strings and objects.

Code: Select all

``````arr1 := [1, 2, 3, 8]
arr2 := [1, 2, 3, 8]
arr3 := [8, 2, 1, 3]

A.isEqual(arr1, arr2)
; => true

A.isEqual(arr1, arr2, arr3)
; => false``````