Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
child(path) {
if (!isString(path)) {
throw new Error("snapshot().child(*) 'path' must be a string value");
}
let value = deepGet(this._snapshot.value, path);
if (value === undefined) {
value = null;
}
const childRef = this._ref.child(path);
return new DatabaseDataSnapshot(childRef, {
value,
key: childRef.key,
exists: value !== null,
childKeys: isObject(value) ? Object.keys(value) : [],
});
}
hasChild(path) {
if (!isString(path)) {
throw new Error("snapshot.hasChild(*) 'path' must be a string value.");
}
return deepGet(this._snapshot.value, path) !== undefined;
}