{"ScriptPreparationCode":"var test = [\r\n { id: \u0027649c69eaa50f1d609949c25f\u0027 },\r\n { id: \u0027649b925d6c544a0fc4bee0ec\u0027 },\r\n { id: \u0027649c81097035ecbfdafd6c26\u0027 },\r\n { id: \u0027649c94eee84a19628209d172\u0027 },\r\n { id: \u0027649bf4b554c98dff97659ea8\u0027 },\r\n { id: \u0027649c7a75837b6102d2190846\u0027 },\r\n { id: \u0027649b34c0d95e01cfffcd9eb8\u0027 },\r\n { id: \u0027649b60e4cf83d21960f598c8\u0027 },\r\n { id: \u0027649c84f1a08aae92538e635c\u0027 },\r\n { id: \u0027649cb032da90ba90bd735383\u0027 },\r\n { id: \u0027649c9ca83180cf2a8366783e\u0027 },\r\n { id: \u0027649c48249e21e4bdcba37975\u0027 },\r\n { id: \u0027649c7a75837b6102d2190846\u0027 },\r\n { id: \u0027649c94eee84a19628209d172\u0027 },\r\n { id: \u0027649bf6f970f6380b5758fbad\u0027 },\r\n { id: \u0027649cb032da90ba90bd735383\u0027 },\r\n { id: \u0027649c81369e21e4bdcba39b06\u0027 },\r\n { id: \u0027649b60e4cf83d21960f598c8\u0027 },\r\n { id: \u0027649b4e94f269eeeb85c56a94\u0027 },\r\n { id: \u0027649bf4b554c98dff97659ea8\u0027 },\r\n { id: \u0027649cb032da90ba90bd735383\u0027 },\r\n { id: \u0027649c9ca83180cf2a8366783e\u0027 },\r\n { id: \u0027649c48249e21e4bdcba37972\u0027 },\r\n { id: \u0027649cb032da90ba90bd735386\u0027 },\r\n { id: \u0027649c9ca83180cf2a8366782e\u0027 },\r\n];\r\n\r\nvar array = new Array(6).fill(test).flatMap(value =\u003E [...value])","TestCases":[{"Name":"filter","Code":"function dedupeByProperty(items, prop) {\r\n const merged = [];\r\n return items.filter((c) =\u003E {\r\n const reference = c[prop];\r\n const isNotInArray = !merged.includes(reference);\r\n if (isNotInArray) merged.push(reference);\r\n return isNotInArray;\r\n });\r\n};\r\n\r\ndedupeByProperty(array, \u0027id\u0027);","IsDeferred":false},{"Name":"hash","Code":"function dedupeByProperty(items, prop) {\r\n const hash = {};\r\n const merged = [];\r\n const len = items.length - 1;\r\n for (let i = 0; i \u003C= len; i \u002B= 1) {\r\n const ref = items[i][prop];\r\n if (!hash[ref]) {\r\n hash[ref] = true;\r\n merged.push(items[i]);\r\n }\r\n }\r\n return merged;\r\n};\r\n\r\ndedupeByProperty(array, \u0027id\u0027);","IsDeferred":false},{"Name":"set","Code":"function dedupeByProperty(items, prop) {\r\n const merged = new Set();\r\n return items.filter((c) =\u003E {\r\n const reference = c[prop];\r\n const isNotInSet = !merged.has(reference);\r\n if (isNotInSet) merged.add(reference);\r\n return isNotInSet;\r\n });\r\n};\r\n\r\ndedupeByProperty(array, \u0027id\u0027);","IsDeferred":false}]}