UNPKG

cpt-waffle-lotide

Version:
22 lines (19 loc) 528 B
const primatives:[string, string, string] = ['number', 'string', 'boolean']; const eqArrays = (a:any[], a2:any[]):boolean => { if (a.length !== a2.length) return false; for (let i in a) { if (primatives.indexOf(typeof a[i]) !== -1 && primatives.indexOf(typeof a2[i]) !== -1) { if (a[i] !== a2[i]) return false; } else { if (Array.isArray(a[i]) && Array.isArray(a2[i])) { if (!eqArrays(a[i], a2[i])) { return false; } } else { return false; } } } return true; } export default eqArrays;