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.
Entity Profile
Dependency Diagram
graph LR e1818dc8_8989_ecc6_1d2a_b7ee88bf0a40["bind-dynamic-keys.ts"] 49aae190_0a6d_f5d1_c8de_aabde088509c["debug"] e1818dc8_8989_ecc6_1d2a_b7ee88bf0a40 --> 49aae190_0a6d_f5d1_c8de_aabde088509c 8ffc8513_97a6_feaa_6bc2_e31c949e66cd["index.ts"] 8ffc8513_97a6_feaa_6bc2_e31c949e66cd --> e1818dc8_8989_ecc6_1d2a_b7ee88bf0a40 style e1818dc8_8989_ecc6_1d2a_b7ee88bf0a40 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
Functions
Dependencies
- debug
Imported By
Source
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 VueCore 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: 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