Home / File/ bind-object-props.ts — vue Source File

bind-object-props.ts — vue Source File

Architecture documentation for bind-object-props.ts, a typescript file in the vue codebase. 3 imports, 1 dependents.

File typescript VueCore Instance 3 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  e665a9cd_89b3_bcf8_a6c0_b4d2815a5faa["bind-object-props.ts"]
  a9349ba5_bc74_f03e_b748_41eb2dcc87a9["config"]
  e665a9cd_89b3_bcf8_a6c0_b4d2815a5faa --> a9349ba5_bc74_f03e_b748_41eb2dcc87a9
  90a2398a_1498_3263_c62e_0c064dd2c9b3["index"]
  e665a9cd_89b3_bcf8_a6c0_b4d2815a5faa --> 90a2398a_1498_3263_c62e_0c064dd2c9b3
  ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"]
  e665a9cd_89b3_bcf8_a6c0_b4d2815a5faa --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1
  8ffc8513_97a6_feaa_6bc2_e31c949e66cd["index.ts"]
  8ffc8513_97a6_feaa_6bc2_e31c949e66cd --> e665a9cd_89b3_bcf8_a6c0_b4d2815a5faa
  style e665a9cd_89b3_bcf8_a6c0_b4d2815a5faa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import config from 'core/config'

import {
  warn,
  isObject,
  toObject,
  isReservedAttribute,
  camelize,
  hyphenate,
  isArray
} from 'core/util/index'
import type { VNodeData } from 'types/vnode'

/**
 * Runtime helper for merging v-bind="object" into a VNode's data.
 */
export function bindObjectProps(
  data: any,
  tag: string,
  value: any,
  asProp: boolean,
  isSync?: boolean
): VNodeData {
  if (value) {
    if (!isObject(value)) {
      __DEV__ &&
        warn('v-bind without argument expects an Object or Array value', this)
    } else {
      if (isArray(value)) {
        value = toObject(value)
      }
      let hash
      for (const key in value) {
        if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
          hash = data
        } else {
          const type = data.attrs && data.attrs.type
          hash =
            asProp || config.mustUseProp(tag, type, key)
              ? data.domProps || (data.domProps = {})
              : data.attrs || (data.attrs = {})
        }
        const camelizedKey = camelize(key)
        const hyphenatedKey = hyphenate(key)
        if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
          hash[key] = value[key]

          if (isSync) {
            const on = data.on || (data.on = {})
            on[`update:${key}`] = function ($event) {
              value[key] = $event
            }
          }
        }
      }
    }
  }
  return data
}

Domain

Subdomains

Functions

Dependencies

  • config
  • index
  • vnode

Frequently Asked Questions

What does bind-object-props.ts do?
bind-object-props.ts is a source file in the vue codebase, written in typescript. It belongs to the VueCore domain, Instance subdomain.
What functions are defined in bind-object-props.ts?
bind-object-props.ts defines 1 function(s): bindObjectProps.
What does bind-object-props.ts depend on?
bind-object-props.ts imports 3 module(s): config, index, vnode.
What files import bind-object-props.ts?
bind-object-props.ts is imported by 1 file(s): index.ts.
Where is bind-object-props.ts in the architecture?
bind-object-props.ts is located at src/core/instance/render-helpers/bind-object-props.ts (domain: VueCore, subdomain: Instance, directory: src/core/instance/render-helpers).

Analyze Your Own Codebase

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

Try Supermodel Free