workers-firebase
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -19,6 +19,6 @@ import { decode, decodeValue } from './serializer'; | ||
get exists() { | ||
return !!this[docSymbol].fields; | ||
return !!this[docSymbol]?.fields; | ||
} | ||
data() { | ||
return this[docSymbol].fields && decode(this.ref.firestore, this[docSymbol].fields) || null; | ||
return this[docSymbol]?.fields && decode(this.ref.firestore, this[docSymbol].fields) || null; | ||
} | ||
@@ -25,0 +25,0 @@ get(field) { |
@@ -58,3 +58,3 @@ var _a; | ||
const segments = typeof path === 'string' ? trim(path).split('/') : path; | ||
if (segments.length % 2 === 0) | ||
if (segments.length % 2 !== 0) | ||
throw new Error('A document reference must have an even number of segments'); | ||
@@ -61,0 +61,0 @@ this.segments = segments; |
{ | ||
"name": "workers-firebase", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "start": "tsc --watch", |
@@ -27,7 +27,7 @@ import { DocumentReference } from './reference'; | ||
get exists() { | ||
return !!this[docSymbol].fields; | ||
return !!this[docSymbol]?.fields; | ||
} | ||
data() { | ||
return this[docSymbol].fields && decode(this.ref.firestore, this[docSymbol].fields) || null; | ||
return this[docSymbol]?.fields && decode(this.ref.firestore, this[docSymbol].fields) || null; | ||
} | ||
@@ -34,0 +34,0 @@ |
@@ -67,3 +67,3 @@ import type { | ||
const segments = typeof path === 'string' ? trim(path).split('/') : path; | ||
if (segments.length % 2 === 0) throw new Error('A document reference must have an even number of segments'); | ||
if (segments.length % 2 !== 0) throw new Error('A document reference must have an even number of segments'); | ||
this.segments = segments; | ||
@@ -70,0 +70,0 @@ } |
133286