Home / Function/ looseEqual() — vue Function Reference

looseEqual() — vue Function Reference

Architecture documentation for the looseEqual() function in util.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  e209b0d9_ee94_da5d_14f4_499aa19837cb["looseEqual()"]
  fb93f205_0dbe_6e8b_730c_c91bb2e93aad["model()"]
  fb93f205_0dbe_6e8b_730c_c91bb2e93aad -->|calls| e209b0d9_ee94_da5d_14f4_499aa19837cb
  61aa7720_5a1a_15d6_8b6c_2a96081e6ff4["actuallySetSelected()"]
  61aa7720_5a1a_15d6_8b6c_2a96081e6ff4 -->|calls| e209b0d9_ee94_da5d_14f4_499aa19837cb
  433d7ea2_6f6c_47e7_74d8_d782032eccb2["hasNoMatchingOption()"]
  433d7ea2_6f6c_47e7_74d8_d782032eccb2 -->|calls| e209b0d9_ee94_da5d_14f4_499aa19837cb
  1d37bd4d_fcd6_18b0_52a8_e66a80a8f659["directive.componentUpdated()"]
  1d37bd4d_fcd6_18b0_52a8_e66a80a8f659 -->|calls| e209b0d9_ee94_da5d_14f4_499aa19837cb
  6d622d50_6a3e_1574_2e13_bf98a183dd8a["looseIndexOf()"]
  6d622d50_6a3e_1574_2e13_bf98a183dd8a -->|calls| e209b0d9_ee94_da5d_14f4_499aa19837cb
  3d975ef8_6070_36a5_82f8_9180576e2ca1["isObject()"]
  e209b0d9_ee94_da5d_14f4_499aa19837cb -->|calls| 3d975ef8_6070_36a5_82f8_9180576e2ca1
  style e209b0d9_ee94_da5d_14f4_499aa19837cb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/shared/util.ts lines 305–344

export function looseEqual(a: any, b: any): boolean {
  if (a === b) return true
  const isObjectA = isObject(a)
  const isObjectB = isObject(b)
  if (isObjectA && isObjectB) {
    try {
      const isArrayA = Array.isArray(a)
      const isArrayB = Array.isArray(b)
      if (isArrayA && isArrayB) {
        return (
          a.length === b.length &&
          a.every((e: any, i: any) => {
            return looseEqual(e, b[i])
          })
        )
      } else if (a instanceof Date && b instanceof Date) {
        return a.getTime() === b.getTime()
      } else if (!isArrayA && !isArrayB) {
        const keysA = Object.keys(a)
        const keysB = Object.keys(b)
        return (
          keysA.length === keysB.length &&
          keysA.every(key => {
            return looseEqual(a[key], b[key])
          })
        )
      } else {
        /* istanbul ignore next */
        return false
      }
    } catch (e: any) {
      /* istanbul ignore next */
      return false
    }
  } else if (!isObjectA && !isObjectB) {
    return String(a) === String(b)
  } else {
    return false
  }
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does looseEqual() do?
looseEqual() is a function in the vue codebase.
What does looseEqual() call?
looseEqual() calls 1 function(s): isObject.
What calls looseEqual()?
looseEqual() is called by 5 function(s): actuallySetSelected, directive.componentUpdated, hasNoMatchingOption, looseIndexOf, model.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free