Skip to content

Commit

Permalink
refactor: Rename updatePartial method to mergeItemData in CollectionR…
Browse files Browse the repository at this point in the history
…eference

This commit renames the `updatePartial` method to `mergeItemData` in the `CollectionReference` class. The purpose of this change is to provide a more descriptive and accurate method name that reflects the behavior of merging partial data into an existing item. This change aligns with the recent refactoring of other methods in the `CollectionReference` class, such as `remove` to `removeItem`, `append` to `appendItem`, and `add` to `addItem`. The renaming of methods improves code readability and consistency.

BREAKING CHANGE: The `updatePartial` method has been replaced with `mergeItemData` in the `CollectionReference` class. Developers should update their code to use the new method name.
  • Loading branch information
alimd committed Sep 2, 2024
1 parent 45a9309 commit e091900
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/reference/src/collection-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ export class CollectionReference<TItem extends JsonifiableObject = JsonifiableOb
*
* @example
* ```typescript
* collectionRef.updatePartial(itemId, partialUpdate);
* collectionRef.mergeItemData(itemId, partialUpdate);
* ```
*/
updatePartial(itemId: string | number, data: Partial<TItem>): void {
this.logger__.logMethodArgs?.('updatePartial', {itemId, data});
mergeItemData(itemId: string | number, data: Partial<TItem>): void {
this.logger__.logMethodArgs?.('mergeItemData', {itemId, data});
Object.assign(this.item__(itemId).data, data);
this.updated__(itemId);
}
Expand Down

0 comments on commit e091900

Please sign in to comment.