Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve cases when comparing arrays to non-array values #18

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: resolve cases when comparing arrays to non-array values
Máté Szentgróti committed Jun 21, 2024
commit 91efdfc0b9763340c57e26e37d986f52438d31a5
5 changes: 3 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@ import { isEqualOptions } from "./model";
/**
* Returns true if two data are equal
* @param {any} a - The original data.
* @param {any} b- The data to compare.
* @param {any} b - The data to compare.
* @param {isEqualOptions} options - The options to compare the data.
* @returns boolean
*/
export function isEqual(
@@ -12,7 +13,7 @@ export function isEqual(
options: isEqualOptions = { ignoreArrayOrder: false }
): boolean {
if (typeof a !== typeof b) return false;
if (Array.isArray(a)) {
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) {
return false;
}