Created
June 3, 2016 13:02
-
-
Save kparms/f75469c8c02b21120b284ac638f44e7a to your computer and use it in GitHub Desktop.
Deduplicate Associated Array in JS
This file contains hidden or 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
var parsedData = []; | |
/*KP: In parsedData we have a key called PsId */ | |
/* KP: Deduplicate */ | |
parsedData.forEach(function(value, key) { | |
var seen = []; | |
for (i=0; i < value.length; i++){ | |
if (seen[value[i].PsId]) { | |
value.splice(i,1); | |
i--; } | |
else { seen[value[i].PsId]=true; } | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment