Skip to content

Commit ecb3ae4

Browse files
committed
feat(option): ignores an empty return
1 parent 6989fb5 commit ecb3ae4

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ function install (Vue, options) {
153153
const { firestore } = this.$options
154154
this._firestoreUnbinds = Object.create(null)
155155
this.$firestoreRefs = Object.create(null)
156-
if (!firestore) return
157156
const options = typeof firestore === 'function'
158-
? firestore.call(this, this)
157+
? firestore.call(this)
159158
: firestore
159+
if (!options) return
160160
Object.keys(options).forEach(key => {
161161
this.$bind(key, options[key])
162162
})

test/merging.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,13 @@ test('should merge two functions', () => {
6666
c: db.collection(6)
6767
})
6868
})
69+
70+
test('ignores no return', () => {
71+
const spy = Vue.config.errorHandler = jest.fn()
72+
new Vue({
73+
firestore: _ => {},
74+
render: h => h('p', 'foo')
75+
})
76+
expect(spy).not.toHaveBeenCalled()
77+
spy.mockRestore()
78+
})

0 commit comments

Comments
 (0)