Home / Function/ parseModel() — vue Function Reference

parseModel() — vue Function Reference

Architecture documentation for the parseModel() function in model.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  70ecccf0_c8f4_c3b2_8f70_e182f323e6c3["parseModel()"]
  36fcfc37_216e_9f34_5a69_e976b9f178f6["genAssignmentCode()"]
  36fcfc37_216e_9f34_5a69_e976b9f178f6 -->|calls| 70ecccf0_c8f4_c3b2_8f70_e182f323e6c3
  fc07ad5d_d43e_d857_dbf9_000c42a5dd51["eof()"]
  70ecccf0_c8f4_c3b2_8f70_e182f323e6c3 -->|calls| fc07ad5d_d43e_d857_dbf9_000c42a5dd51
  1c8dccd2_3d16_da45_0f66_656b9394492c["next()"]
  70ecccf0_c8f4_c3b2_8f70_e182f323e6c3 -->|calls| 1c8dccd2_3d16_da45_0f66_656b9394492c
  d5470277_7f50_846d_41c4_d9bb9c937dcb["isStringStart()"]
  70ecccf0_c8f4_c3b2_8f70_e182f323e6c3 -->|calls| d5470277_7f50_846d_41c4_d9bb9c937dcb
  6309f94a_9147_dde5_5f3f_be83bb37bd60["parseString()"]
  70ecccf0_c8f4_c3b2_8f70_e182f323e6c3 -->|calls| 6309f94a_9147_dde5_5f3f_be83bb37bd60
  8b1e6824_ae5a_5ead_1487_de26084ef91d["parseBracket()"]
  70ecccf0_c8f4_c3b2_8f70_e182f323e6c3 -->|calls| 8b1e6824_ae5a_5ead_1487_de26084ef91d
  style 70ecccf0_c8f4_c3b2_8f70_e182f323e6c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/directives/model.ts lines 67–105

export function parseModel(val: string): ModelParseResult {
  // Fix https://github.com/vuejs/vue/pull/7730
  // allow v-model="obj.val " (trailing whitespace)
  val = val.trim()
  len = val.length

  if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
    index = val.lastIndexOf('.')
    if (index > -1) {
      return {
        exp: val.slice(0, index),
        key: '"' + val.slice(index + 1) + '"'
      }
    } else {
      return {
        exp: val,
        key: null
      }
    }
  }

  str = val
  index = expressionPos = expressionEndPos = 0

  while (!eof()) {
    chr = next()
    /* istanbul ignore if */
    if (isStringStart(chr)) {
      parseString(chr)
    } else if (chr === 0x5b) {
      parseBracket(chr)
    }
  }

  return {
    exp: val.slice(0, expressionPos),
    key: val.slice(expressionPos + 1, expressionEndPos)
  }
}

Subdomains

Frequently Asked Questions

What does parseModel() do?
parseModel() is a function in the vue codebase.
What does parseModel() call?
parseModel() calls 5 function(s): eof, isStringStart, next, parseBracket, parseString.
What calls parseModel()?
parseModel() is called by 1 function(s): genAssignmentCode.

Analyze Your Own Codebase

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

Try Supermodel Free