diff options
author | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-05-06 16:01:38 -0400 |
---|---|---|
committer | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-05-06 16:01:38 -0400 |
commit | 488a3af4ffd9cac870a33a1ae358cf90fd957117 (patch) | |
tree | 9206474b9bdd9611741e4c44c1d6f4cc5a9d8af8 /src/fields/List.ts | |
parent | 0c25989104bef9785bf112490c73541bd4bc1764 (diff) |
clean up and comment remFromList
Diffstat (limited to 'src/fields/List.ts')
-rw-r--r-- | src/fields/List.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fields/List.ts b/src/fields/List.ts index eb735dec2..325b36597 100644 --- a/src/fields/List.ts +++ b/src/fields/List.ts @@ -82,11 +82,11 @@ const listHandlers: any = { hintArray.push({val : list.__fields[i], index : i}); } const res = list.__fields.splice(start, deleteCount, ...items); - // console.log(hintArray); - // console.log(list.__fields); + // the hint object sends the starting index of the slice and the number + // of elements to delete. this[Update]( items.length === 0 && deleteCount - ? { op: '$remFromSet', items: removed, hint : { start : start, deleteCount : deleteCount, hintArray : hintArray}, length: list.__fields.length } + ? { op: '$remFromSet', items: removed, hint : { start : start, deleteCount : deleteCount }, length: list.__fields.length } : items.length && !deleteCount && start === list.__fields.length ? { op: '$addToSet', items, length: list.__fields.length } : undefined |