MCPcopy
hub / github.com/vuejs/core / toHandlers

Function toHandlers

packages/runtime-core/src/helpers/toHandlers.ts:8–25  ·  view source on GitHub ↗
(
  obj: Record<string, any>,
  preserveCaseIfNecessary?: boolean,
)

Source from the content-addressed store, hash-verified

6 * @private
7 */
8export function toHandlers(
9 obj: Record<string, any>,
10 preserveCaseIfNecessary?: boolean,
11): Record<string, any> {
12 const ret: Record<string, any> = {}
13 if (__DEV__ && !isObject(obj)) {
14 warn(`v-on with no argument expects an object value.`)
15 return ret
16 }
17 for (const key in obj) {
18 ret[
19 preserveCaseIfNecessary && /[A-Z]/.test(key)
20 ? `on:${key}`
21 : toHandlerKey(key)
22 ] = obj[key]
23 }
24 return ret
25}

Callers 3

toHandlers.spec.tsFile · 0.90
CompFunction · 0.85

Calls 3

isObjectFunction · 0.90
warnFunction · 0.90
testMethod · 0.80

Tested by 1

CompFunction · 0.68