changes
This commit is contained in:
@@ -271,6 +271,11 @@ export default defineNuxtPlugin(() => {
|
||||
};
|
||||
|
||||
const unique = function (arr, keyProps) {
|
||||
// assume keyProps always has 1 element only
|
||||
// assume all elements of arr have the same shape
|
||||
// if keyProps[0] is not a key of arr[0], return []
|
||||
if (!Object.keys(arr[0]).includes(keyProps[0])) return [];
|
||||
|
||||
const kvArray = arr.map((entry) => {
|
||||
const key = keyProps.map((k) => entry[k]).join("|");
|
||||
return [key, entry];
|
||||
|
||||
Reference in New Issue
Block a user