import computed from 'ember-computed';

function truncateInteger(dependentKey, limit) {
  return computed(dependentKey, {
    get() {
      let num = this.get(dependentKey);

      if (num > limit) {
        return `${limit}+`;
      }
      return `${num}`;
    }
  });
}

export { truncateInteger };
