diff options
author | 2021-03-25 00:00:22 -0700 | |
---|---|---|
committer | 2021-03-25 00:00:22 -0700 | |
commit | 30cccdf7154b6470e876464da9e412af10894dd5 (patch) | |
tree | 73ed40b30af23ba3e5b94070e478f3e2ca1670c0 /src/compiler/utils/nodes_match.ts | |
parent | a72ab10c623022860691d6a095b74dea70cc6f69 (diff) | |
download | astro-30cccdf7154b6470e876464da9e412af10894dd5.tar.gz astro-30cccdf7154b6470e876464da9e412af10894dd5.tar.zst astro-30cccdf7154b6470e876464da9e412af10894dd5.zip |
add component state, top-level await support (#26)
Diffstat (limited to 'src/compiler/utils/nodes_match.ts')
-rw-r--r-- | src/compiler/utils/nodes_match.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/compiler/utils/nodes_match.ts b/src/compiler/utils/nodes_match.ts deleted file mode 100644 index 563742635..000000000 --- a/src/compiler/utils/nodes_match.ts +++ /dev/null @@ -1,34 +0,0 @@ -// @ts-nocheck - -export function nodes_match(a, b) { - if (!!a !== !!b) return false; - if (Array.isArray(a) !== Array.isArray(b)) return false; - - if (a && typeof a === 'object') { - if (Array.isArray(a)) { - if (a.length !== b.length) return false; - return a.every((child, i) => nodes_match(child, b[i])); - } - - const a_keys = Object.keys(a).sort(); - const b_keys = Object.keys(b).sort(); - - if (a_keys.length !== b_keys.length) return false; - - let i = a_keys.length; - while (i--) { - const key = a_keys[i]; - if (b_keys[i] !== key) return false; - - if (key === 'start' || key === 'end') continue; - - if (!nodes_match(a[key], b[key])) { - return false; - } - } - - return true; - } - - return a === b; -} |