[firestore] add support for `DocumentSnapshot.get('dot.notated.field.path')`
This commit is contained in:
parent
f1e9d28869
commit
b918eea630
|
@ -63,6 +63,7 @@ export default class DocumentSnapshot {
|
||||||
if (fieldPath instanceof FieldPath) {
|
if (fieldPath instanceof FieldPath) {
|
||||||
return extractFieldPathData(this._data, fieldPath._segments);
|
return extractFieldPathData(this._data, fieldPath._segments);
|
||||||
}
|
}
|
||||||
return this._data ? deepGet(this._data, fieldPath, '.') : undefined;
|
|
||||||
|
return deepGet(this._data, fieldPath, '.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ export function deepGet(
|
||||||
path: string,
|
path: string,
|
||||||
joiner?: string = '/'
|
joiner?: string = '/'
|
||||||
): any {
|
): any {
|
||||||
|
if (!isObject(object)) return undefined;
|
||||||
const keys = path.split(joiner);
|
const keys = path.split(joiner);
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
Loading…
Reference in New Issue