prevent duplicated owners in metadata amendments

This commit is contained in:
ansuz
2019-08-21 12:24:12 +02:00
parent a3a7bcbe35
commit 1c37ec7aee
2 changed files with 14 additions and 1 deletions

11
lib/deduplicate.js Normal file
View File

@@ -0,0 +1,11 @@
// remove duplicate elements in an array
module.exports = function (O) {
// make a copy of the original array
var A = O.slice();
for (var i = 0; i < A.length; i++) {
for (var j = i + 1; j < A.length; j++) {
if (A[i] === A[j]) { A.splice(j--, 1); }
}
}
return A;
};