2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2021-03-31 22:34:20 +00:00
|
|
|
import { helper } from '@ember/component/helper';
|
|
|
|
|
2021-10-14 20:14:33 +00:00
|
|
|
export default helper(function isEmptyValue([value], { hasDefault = false }) {
|
|
|
|
if (hasDefault) {
|
|
|
|
value = hasDefault;
|
|
|
|
}
|
2021-03-31 22:34:20 +00:00
|
|
|
if (typeof value === 'object' && value !== null) {
|
|
|
|
return Object.keys(value).length === 0;
|
|
|
|
}
|
|
|
|
return value == null || value === '';
|
|
|
|
});
|