This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @desc consecutiveRoleIdsCountListWithIndex: | |
* -> will check if each element is the same as the one before it in the array | |
* -> if yes it will skip that id & increment the repeated count by +1, | |
* -> it will preserve the non-consecutive duplicates also | |
* output : [{"roleId":"5fdf1c022a4b9dea","repeatedCount":2,"index":0},{"roleId":"cb1c0e2f-aabd-303b-8db4-94458cf0c3ca","repeatedCount":1,"index":2},{"roleId":"5fdf1c022a4b9dea","repeatedCount":1,"index":3},{"roleId":"da0384e0-3e89-3df9-9f7f-191e5766d36b","repeatedCount":1,"index":4}] | |
* @param arrayList | |
* @returns [] | |
*/ | |
function consecutiveRoleIdsCountListWithIndex(arrayList) { |