2019-12-17 19:27:28 +00:00
|
|
|
import { helper } from '@ember/component/helper';
|
|
|
|
|
2020-09-18 10:14:06 +00:00
|
|
|
export default helper(function routeMatch([item], hash) {
|
|
|
|
const keys = Object.keys(item.data || item);
|
2019-12-17 19:27:28 +00:00
|
|
|
switch (true) {
|
|
|
|
case keys.includes('Present'):
|
2020-09-18 10:14:06 +00:00
|
|
|
return `${item.Invert ? `NOT ` : ``}present`;
|
2019-12-17 19:27:28 +00:00
|
|
|
case keys.includes('Exact'):
|
2020-09-18 10:14:06 +00:00
|
|
|
return `${item.Invert ? `NOT ` : ``}exactly matching "${item.Exact}"`;
|
2019-12-17 19:27:28 +00:00
|
|
|
case keys.includes('Prefix'):
|
2020-09-18 10:14:06 +00:00
|
|
|
return `${item.Invert ? `NOT ` : ``}prefixed by "${item.Prefix}"`;
|
2019-12-17 19:27:28 +00:00
|
|
|
case keys.includes('Suffix'):
|
2020-09-18 10:14:06 +00:00
|
|
|
return `${item.Invert ? `NOT ` : ``}suffixed by "${item.Suffix}"`;
|
2019-12-17 19:27:28 +00:00
|
|
|
case keys.includes('Regex'):
|
2020-09-18 10:14:06 +00:00
|
|
|
return `${item.Invert ? `NOT ` : ``}matching the regex "${item.Regex}"`;
|
2019-12-17 19:27:28 +00:00
|
|
|
}
|
|
|
|
return '';
|
|
|
|
});
|