equ()

in packages/utils/utils/src/index.ts [42:54]


	equ(a: any, b: any) {
		// Wrong type or one of the two undefined, doesn't match
		if (typeof a !== typeof b || !!a !== !!b) return false
		// Atomic, just compare a against b
		if (is.str(a) || is.num(a) || is.obj(a)) return a === b
		// Array, shallow compare first to see if it's a match
		if (is.arr(a) && a == b) return true
		// Last resort, go through keys
		let i
		for (i in a) if (!(i in b)) return false
		for (i in b) if (a[i] !== b[i]) return false
		return is.und(i) ? a === b : true
	},