Closed kwoktung closed 1 month ago
Improved the bulkSetItemsWithUniq
Method
Refreshed the ServiceAddressBook
to remove duplicate addresses and names.
Added currentAddressSet
and currentNameSet
Mechanism
Created records of unique, lowercased addresses and names currently in use.
Introduced itemsUniq
Array
An array to collect unique items during the array traversal.
Iterated Over items
Array with For Loop
Loop to check each incoming item and ensure it's unique.
Added Verification Checks Each item's address and name are lowercased and checked against current sets to find potential duplicates.
Added Delays And Timestamp For Duplicates For duplicate names, a delay mechanism and a timestamp appendage to the name was introduced to ensure uniqueness.
Updated Items in Service
The clean collection of unique items was used to update the ServiceAddressBook
at the end.
Review or Edit in CodeSandbox
Open the branch in Web Editor • VS Code • Insiders
Open Preview