-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
I have an idea that, in addition to push, update, remove etc ... perhaps, for completeness, we should include destructive set method in FirebaseListObservable, implemented consistently like so:
set(item?: FirebaseOperation, value?: Object): firebase.Promise<void> {
if (!value){
throw new Error("The set method requires a defined non-null value. Use remove method to delete instead.");
}
// if no item parameter is provided, destructively replace the whole list with value
if (!item) {
return this.$ref.ref.set(value);
}
return this._checkOperationCases(item, {
stringCase: () => this.$ref.ref.child(<string>item).set(value),
firebaseCase: () => (<firebase.database.Reference>item).set(value),
snapshotCase: () => (<firebase.database.DataSnapshot>item).ref.set(value),
unwrappedSnapshotCase: () => this.$ref.ref.child((<AFUnwrappedDataSnapshot>item).$key).set(value)
});
}What do y'all think?
I could PR if fair game
Metadata
Metadata
Assignees
Labels
No labels