Evan You c9bf7ded2e refactor(types): mark internal API exports and exclude from d.ts
BREAKING CHANGE: Internal APIs are now excluded from type decalrations.
2020-04-30 17:04:35 -04:00

19 lines
445 B
TypeScript

import { isObject } from '@vue/shared'
import { warn } from '../warning'
/**
* For prefixing keys in v-on="obj" with "on"
* @internal
*/
export function toHandlers(obj: Record<string, any>): Record<string, any> {
const ret: Record<string, any> = {}
if (__DEV__ && !isObject(obj)) {
warn(`v-on with no argument expects an object value.`)
return ret
}
for (const key in obj) {
ret[`on${key}`] = obj[key]
}
return ret
}