How to use the ember-intl/utils/empty-object function in ember-intl

To help you get started, we’ve selected a few ember-intl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-intl / ember-intl / addon / utils / macro.js View on Github external
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();
}
github ember-intl / ember-intl / addon / utils / array-to-hash.js View on Github external
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;
}