portainer/app/kubernetes/helpers/commonHelper.js

13 lines
294 B
JavaScript

import _ from 'lodash-es';
class KubernetesCommonHelper {
static assignOrDeleteIfEmpty(obj, path, value) {
if (!value || (value instanceof Array && !value.length)) {
_.unset(obj, path);
} else {
_.set(obj, path, value);
}
}
}
export default KubernetesCommonHelper;