mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-21 19:11:34 +08:00
[firestore] add support for DocumentSnapshot.get('dot.notated.field.path')
This commit is contained in:
@@ -63,6 +63,7 @@ export default class DocumentSnapshot {
|
||||
if (fieldPath instanceof FieldPath) {
|
||||
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,
|
||||
joiner?: string = '/'
|
||||
): any {
|
||||
if (!isObject(object)) return undefined;
|
||||
const keys = path.split(joiner);
|
||||
|
||||
let i = 0;
|
||||
|
||||
Reference in New Issue
Block a user