array-comparisoncomparisoncomparison-tooldeep-diffdiffjson-diffnodejsobject-comparisonobject-diffobjectdiffobjectdifferencereactstreamingstreaming-datatypescript
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
412 B
15 lines
412 B
2 years ago
|
export function isEqual(a: any, b: any): boolean {
|
||
|
if (typeof a !== typeof b) return true;
|
||
|
if (Array.isArray(a)) {
|
||
|
return a.toString() === b.toString();
|
||
|
}
|
||
|
if (typeof a === "object") {
|
||
|
return JSON.stringify(a) === JSON.stringify(b);
|
||
|
}
|
||
|
return a === b;
|
||
|
}
|
||
|
|
||
|
export function hasNestedValues(value: any): value is Record<string, any> {
|
||
|
return typeof value === "object" && !Array.isArray(value);
|
||
|
}
|