<commit_before>import Ember from 'ember';
import moment from 'moment';

const { later:runLater } = Ember.run;

export var helperFactory = function(cb) {
  let ago;

  if (Ember.Helper) {
    ago = Ember.Helper.extend({
      compute: function(params, hash) {
        if (typeof cb === 'function') {
          cb();
        }
        if (params.length === 0) {
          throw new TypeError('Invalid Number of arguments, expected at least 1');
        }
        if (hash.interval) {
          runLater(this, this.recompute, hash.interval);
        }
        return moment.apply(this, params).fromNow();
      }
    });
  }
  else {
    ago = function(params) {
      if (typeof cb === 'function') {
        cb();
      }
      if (params.length === 0) {
        throw new TypeError('Invalid Number of arguments, expected at least 1');
      }
      return moment.apply(this, params).fromNow();
    };
  }
  return ago;
};

export default helperFactory();
<commit_msg>Update moment-from-now.js<commit_after>import Ember from 'ember';
import moment from 'moment';

const { later:runLater } = Ember.run;

export var helperFactory = function(cb) {
  let ago;

  if (Ember.Helper) {
    ago = Ember.Helper.extend({
      compute: function(params, hash) {
        if (typeof cb === 'function') {
          cb();
        }
        if (params.length === 0) {
          throw new TypeError('Invalid Number of arguments, expected at least 1');
        }
        if (hash.interval) {
          runLater(this, this.recompute, parseInt(hash.interval, 10));
        }
        return moment.apply(this, params).fromNow();
      }
    });
  }
  else {
    ago = function(params) {
      if (typeof cb === 'function') {
        cb();
      }
      if (params.length === 0) {
        throw new TypeError('Invalid Number of arguments, expected at least 1');
      }
      return moment.apply(this, params).fromNow();
    };
  }
  return ago;
};

export default helperFactory();

{'fraction_non_alphanumeric': 0.13891726251276812, 'fraction_numerical': 0.005107252298263534, 'mean_word_length': 2.243377483443709, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199991', 'n_tokens_mistral': 594, 'n_tokens_neox': 578, 'n_words': 160}