open-consul/ui/packages/consul-ui/app/helpers/uniq-by.js
Ronald 6bcb98ea71
Add UI copyright headers files (#16614)
* Add copyright headers to UI files

* Ensure copywrite file ignores external libs
2023-03-14 09:18:55 -04:00

19 lines
381 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { helper } from '@ember/component/helper';
import { isEmpty } from '@ember/utils';
import { A as emberArray } from '@ember/array';
export function uniqBy([byPath, array]) {
if (isEmpty(byPath)) {
return [];
}
return emberArray(array).uniqBy(byPath);
}
export default helper(uniqBy);