[firestore] add support for `DocumentSnapshot.get('dot.notated.field.path')`

This commit is contained in:
Salakar 2018-04-12 12:38:28 +01:00
parent f1e9d28869
commit b918eea630
2 changed files with 3 additions and 1 deletions

View File

@ -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, '.');
}
}

View File

@ -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;