2018-10-19 15:17:02 +00:00
|
|
|
import { helper } from '@ember/component/helper';
|
|
|
|
import { get } from '@ember/object';
|
|
|
|
|
2018-11-02 14:44:36 +00:00
|
|
|
const _isLegacy = function(token) {
|
|
|
|
const rules = get(token, 'Rules');
|
|
|
|
return get(token, 'Legacy') || (rules != null && rules.trim() != '');
|
|
|
|
};
|
2018-10-19 15:17:02 +00:00
|
|
|
export function isLegacy(params, hash) {
|
|
|
|
const token = params[0];
|
2018-11-02 14:44:36 +00:00
|
|
|
// is array like (RecordManager isn't an array)
|
|
|
|
if (typeof token.length !== 'undefined') {
|
|
|
|
return token.find(function(item) {
|
|
|
|
return _isLegacy(item);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return _isLegacy(token);
|
2018-10-19 15:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default helper(isLegacy);
|