Home / File/ bind-dynamic-keys.ts — vue Source File

bind-dynamic-keys.ts — vue Source File

Architecture documentation for bind-dynamic-keys.ts, a typescript file in the vue codebase. 1 imports, 1 dependents.

File typescript CoreRuntime Instance 1 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  71884ec5_04b3_568f_efb9_3e3c6cdaaa54["bind-dynamic-keys.ts"]
  5e280904_7607_16e2_62e5_1d6d092f34a6["debug"]
  71884ec5_04b3_568f_efb9_3e3c6cdaaa54 --> 5e280904_7607_16e2_62e5_1d6d092f34a6
  8456d994_c5db_04c1_7466_74c5274c4133["index.ts"]
  8456d994_c5db_04c1_7466_74c5274c4133 --> 71884ec5_04b3_568f_efb9_3e3c6cdaaa54
  style 71884ec5_04b3_568f_efb9_3e3c6cdaaa54 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
// For example, the following template:
//
// <div id="app" :[key]="value">
//
// compiles to the following:
//
// _c('div', { attrs: bindDynamicKeys({ "id": "app" }, [key, value]) })

import { warn } from 'core/util/debug'

export function bindDynamicKeys(
  baseObj: Record<string, any>,
  values: Array<any>
): Object {
  for (let i = 0; i < values.length; i += 2) {
    const key = values[i]
    if (typeof key === 'string' && key) {
      baseObj[values[i]] = values[i + 1]
    } else if (__DEV__ && key !== '' && key !== null) {
      // null is a special value for explicitly removing a binding
      warn(
        `Invalid value for dynamic directive argument (expected string or null): ${key}`,
        this
      )
    }
  }
  return baseObj
}

// helper to dynamically append modifier runtime markers to event names.
// ensure only append when value is already string, otherwise it will be cast
// to string and cause the type check to miss.
export function prependModifier(value: any, symbol: string): any {
  return typeof value === 'string' ? symbol + value : value
}

Domain

Subdomains

Dependencies

  • debug

Frequently Asked Questions

What does bind-dynamic-keys.ts do?
bind-dynamic-keys.ts is a source file in the vue codebase, written in typescript. It belongs to the CoreRuntime domain, Instance subdomain.
What functions are defined in bind-dynamic-keys.ts?
bind-dynamic-keys.ts defines 2 function(s): bindDynamicKeys, prependModifier.
What does bind-dynamic-keys.ts depend on?
bind-dynamic-keys.ts imports 1 module(s): debug.
What files import bind-dynamic-keys.ts?
bind-dynamic-keys.ts is imported by 1 file(s): index.ts.
Where is bind-dynamic-keys.ts in the architecture?
bind-dynamic-keys.ts is located at src/core/instance/render-helpers/bind-dynamic-keys.ts (domain: CoreRuntime, 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