refactor: use more descriptive argument name
This commit is contained in:
parent
871947c25f
commit
b946a6b7f7
@ -72,7 +72,7 @@ const EMPTY_PROPS = { props: EMPTY_OBJ }
|
|||||||
// - if has declared props: put declared ones in `props`, the rest in `attrs`
|
// - if has declared props: put declared ones in `props`, the rest in `attrs`
|
||||||
// - else: everything goes in `props`.
|
// - else: everything goes in `props`.
|
||||||
export function resolveProps(
|
export function resolveProps(
|
||||||
raw: any,
|
rawData: any,
|
||||||
rawOptions: ComponentPropsOptions | void,
|
rawOptions: ComponentPropsOptions | void,
|
||||||
Component: ComponentClass | FunctionalComponent
|
Component: ComponentClass | FunctionalComponent
|
||||||
): { props: Data; attrs?: Data } {
|
): { props: Data; attrs?: Data } {
|
||||||
@ -81,13 +81,13 @@ export function resolveProps(
|
|||||||
normalizePropsOptions(
|
normalizePropsOptions(
|
||||||
rawOptions as ComponentPropsOptions
|
rawOptions as ComponentPropsOptions
|
||||||
)) as NormalizedPropsOptions
|
)) as NormalizedPropsOptions
|
||||||
if (!raw && !hasDeclaredProps) {
|
if (!rawData && !hasDeclaredProps) {
|
||||||
return EMPTY_PROPS
|
return EMPTY_PROPS
|
||||||
}
|
}
|
||||||
const props: any = {}
|
const props: any = {}
|
||||||
let attrs: any = void 0
|
let attrs: any = void 0
|
||||||
if (raw) {
|
if (rawData != null) {
|
||||||
for (const key in raw) {
|
for (const key in rawData) {
|
||||||
// key, ref, slots are reserved
|
// key, ref, slots are reserved
|
||||||
if (key === 'key' || key === 'ref' || key === 'slots') {
|
if (key === 'key' || key === 'ref' || key === 'slots') {
|
||||||
continue
|
continue
|
||||||
@ -105,12 +105,12 @@ export function resolveProps(
|
|||||||
(hasDeclaredProps && !options.hasOwnProperty(key))
|
(hasDeclaredProps && !options.hasOwnProperty(key))
|
||||||
) {
|
) {
|
||||||
const newKey = isNativeOn ? 'on' + key.slice(8) : key
|
const newKey = isNativeOn ? 'on' + key.slice(8) : key
|
||||||
;(attrs || (attrs = {}))[newKey] = raw[key]
|
;(attrs || (attrs = {}))[newKey] = rawData[key]
|
||||||
} else {
|
} else {
|
||||||
if (__DEV__ && hasDeclaredProps && options.hasOwnProperty(key)) {
|
if (__DEV__ && hasDeclaredProps && options.hasOwnProperty(key)) {
|
||||||
validateProp(key, raw[key], options[key], Component)
|
validateProp(key, rawData[key], options[key], Component)
|
||||||
}
|
}
|
||||||
props[key] = raw[key]
|
props[key] = rawData[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user