2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2020-09-08 16:53:51 +00:00
|
|
|
import { helper as buildHelper } from '@ember/component/helper';
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
export function isWildcardString([string]) {
|
2020-09-08 16:53:51 +00:00
|
|
|
if (!string) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// string is actually an object which is what comes in in the searchSelect component
|
|
|
|
if (typeof string === 'object') {
|
2020-09-08 20:24:27 +00:00
|
|
|
// if the dropdown is used the object is a class which cannot be converted into a string
|
|
|
|
if (Object.prototype.hasOwnProperty.call(string, 'store')) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
string = Object.values(string).toString();
|
2020-09-08 16:53:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return string.includes('*');
|
|
|
|
}
|
|
|
|
|
|
|
|
export default buildHelper(isWildcardString);
|