mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-15 03:28:07 +01:00
This commit is contained in:
parent
0cd68fe571
commit
e94a534b02
9 changed files with 111 additions and 114 deletions
|
|
@ -46,3 +46,13 @@ export const isFileAnnotation = (text: string) => {
|
|||
export const looseJsonParse = (text: string) => {
|
||||
return Function(`"use strict";return (${text})`)();
|
||||
};
|
||||
|
||||
export const objEquals = (a: any, b: any): boolean => {
|
||||
if (a === b) return true;
|
||||
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
|
||||
if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) return a === b;
|
||||
if (a.prototype !== b.prototype) return false;
|
||||
const keys = Object.keys(a);
|
||||
if (keys.length !== Object.keys(b).length) return false;
|
||||
return keys.every(k => objEquals(a[k], b[k]));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue