mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Move getSymmetricDifference to helper file
This commit is contained in:
parent
ce710b1f55
commit
79640781bc
2 changed files with 24 additions and 9 deletions
21
helpers/array.js
Normal file
21
helpers/array.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export function getSymmetricDifference (a, b) {
|
||||
return [
|
||||
a.filter(x => !b.includes(x)),
|
||||
b.filter(x => !a.includes(x))
|
||||
]
|
||||
}
|
||||
|
||||
export function logArraysDifference (a, b) {
|
||||
const [ aOnly, bOnly ] = getSymmetricDifference(a, b)
|
||||
|
||||
|
||||
console.log( 'Missing from first list:', aOnly )
|
||||
console.log( 'Missing from second list:', bOnly )
|
||||
|
||||
console.log( `List difference Count ${ aOnly.length } / ${ bOnly.length }`, )
|
||||
|
||||
return {
|
||||
aOnly,
|
||||
bOnly,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue