Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function createTranslatedComputedProperty(key, options) {
const hash = options || new EmptyObject();
const dependentKeys = ['intl.locale'].concat(values(hash));
return computed(...dependentKeys, function() {
const intl = get(this, 'intl');
assert(
`Cannot translate "${key}".\n${this} does not have an intl property set. Try: intl: Ember.inject.service()`,
intl
);
return intl.t(key, mapPropertiesByHash(this, hash));
}).readOnly();
}
function arrayToHash(array) {
const len = array.length;
const out = new EmptyObject();
let i = 0;
for (; i < len; i++) {
const key = array[i];
out[key] = key;
}
return out;
}