Skip to content

Commit 3bef785

Browse files
committed
refactor: rename params
1 parent 12c6686 commit 3bef785

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

packages/create-instance/create-component-stubs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function createStubFromString (
118118
templateString: string,
119119
originalComponent: Component = {},
120120
name: string,
121-
_Vue
121+
_Vue: Component
122122
): Component {
123123
if (templateContainsComponent(templateString, name)) {
124124
throwError('options.stub cannot contain a circular reference')

packages/create-instance/create-instance.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ export default function createInstance (
116116

117117
const scopedSlots = createScopedSlots(options.scopedSlots, _Vue)
118118

119-
if (
120-
options.parentComponent &&
121-
!isPlainObject(options.parentComponent)
122-
) {
119+
if (options.parentComponent && !isPlainObject(options.parentComponent)) {
123120
throwError(
124121
`options.parentComponent should be a valid Vue component options object`
125122
)

packages/shared/validators.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@ export function isDomSelector (selector: any): boolean {
2828
}
2929
}
3030

31-
export function isVueComponent (component: any): boolean {
32-
if (typeof component === 'function' && component.options) {
31+
export function isVueComponent (c: any): boolean {
32+
if (isConstructor(c)) {
3333
return true
3434
}
3535

36-
if (component === null || typeof component !== 'object') {
36+
if (c === null || typeof c !== 'object') {
3737
return false
3838
}
3939

40-
if (component.extends || component._Ctor) {
40+
if (c.extends || c._Ctor) {
4141
return true
4242
}
4343

44-
if (typeof component.template === 'string') {
44+
if (typeof c.template === 'string') {
4545
return true
4646
}
4747

48-
return typeof component.render === 'function'
48+
return typeof c.render === 'function'
4949
}
5050

5151
export function componentNeedsCompiling (component: Component): boolean {
@@ -76,16 +76,16 @@ export function isNameSelector (nameOptionsObject: any): boolean {
7676
return !!nameOptionsObject.name
7777
}
7878

79-
export function isConstructor (el) {
80-
return typeof el === 'function'
79+
export function isConstructor (c: any) {
80+
return typeof c === 'function' && c.cid
8181
}
8282

83-
export function isDynamicComponent (cmp) {
84-
return typeof cmp === 'function' && !cmp.cid
83+
export function isDynamicComponent (c: any) {
84+
return typeof c === 'function' && !c.cid
8585
}
8686

87-
export function isComponentOptions (el) {
88-
return typeof el === 'object' && (el.template || el.render)
87+
export function isComponentOptions (c: any) {
88+
return typeof c === 'object' && (c.template || c.render)
8989
}
9090

9191
export function templateContainsComponent (
@@ -98,8 +98,8 @@ export function templateContainsComponent (
9898
})
9999
}
100100

101-
export function isPlainObject (obj: any): boolean {
102-
return Object.prototype.toString.call(obj) === '[object Object]'
101+
export function isPlainObject (c: any): boolean {
102+
return Object.prototype.toString.call(c) === '[object Object]'
103103
}
104104

105105
export function isRequiredComponent (name: string): boolean {

0 commit comments

Comments
 (0)