portainer/app/kubernetes/helpers/formValidationHelper.js

16 lines
357 B
JavaScript

import _ from 'lodash-es';
class KubernetesFormValidationHelper {
static getDuplicates(names) {
const groupped = _.groupBy(names);
const res = {};
_.forEach(names, (name, index) => {
if (groupped[name].length > 1 && name) {
res[index] = name;
}
});
return res;
}
}
export default KubernetesFormValidationHelper;