open-vault/ui/app/helpers/is-wildcard-string.js
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

25 lines
667 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { helper as buildHelper } from '@ember/component/helper';
export function isWildcardString([string]) {
if (!string) {
return false;
}
// string is actually an object which is what comes in in the searchSelect component
if (typeof string === 'object') {
// 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();
}
return string.includes('*');
}
export default buildHelper(isWildcardString);