Home / Function/ createCompareFn() — vue Function Reference

createCompareFn() — vue Function Reference

Architecture documentation for the createCompareFn() function in helpers.ts from the vue codebase.

Entity Profile

Relationship Graph

Source Code

test/transition/helpers.ts lines 20–48

function createCompareFn(spy) {
  const hasWarned = msg => {
    let count = spy.calls.count()
    let args
    while (count--) {
      args = spy.calls.argsFor(count)
      if (args.some(containsMsg)) {
        return true
      }
    }

    function containsMsg(arg) {
      return arg.toString().indexOf(msg) > -1
    }
  }

  return {
    compare: msg => {
      asserted = asserted.concat(msg)
      const warned = Array.isArray(msg) ? msg.some(hasWarned) : hasWarned(msg)
      return {
        pass: warned,
        message: warned
          ? 'Expected message "' + msg + '" not to have been warned'
          : 'Expected message "' + msg + '" to have been warned'
      }
    }
  }
}

Domain

Subdomains

Analyze Your Own Codebase

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

Try Supermodel Free