{"size": 1432, "ext": "js", "max_stars_repo_path": "index.js", "max_stars_repo_name": "brucehappy/ember-cli-numeral", "max_stars_repo_stars_event_min_datetime": "2016-10-30T23:23:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-01-27T14:55:23.000Z", "max_issues_repo_path": "index.js", "max_issues_repo_name": "brucehappy/ember-cli-numeral", "max_issues_repo_issues_event_min_datetime": "2016-10-30T20:30:50.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-07T10:22:58.000Z", "max_forks_repo_path": "index.js", "max_forks_repo_name": "brucehappy/ember-cli-numeral", "max_forks_repo_forks_event_min_datetime": "2017-01-10T23:46:01.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-29T23:04:39.000Z"}
{"max_stars_count": 7, "max_issues_count": 10, "max_forks_count": 5, "avg_line_length": 26.0363636364, "max_line_length": 127, "alphanum_fraction": 0.594972067}
/* eslint-env node */
'use strict';

let path = require('path');
let Funnel = require('broccoli-funnel');

module.exports = {
  name: 'ember-cli-numeral',

  included: function(app) {
    this.app = app;

    if (typeof app.import !== 'function' && app.app) {
      this.app = app = app.app;
    }

    this._super.included.apply(this, arguments);

    let appOptions = app.options || {};
    let options = appOptions.numeral || {};

    app.import({
      development: 'vendor/numeral/numeral.js',
      production: 'vendor/numeral/min/numeral.min.js'
    }, {
      using: [{ transformation: 'amd', as: 'numeral' }]
    });

    if (options.includeLanguages) {
      throw new Error('includeLanguages option is no longer available. Please use includeLocales (see the README for usage).');
    }

    if (options.includeLocales) {
      for (let locale of options.includeLocales) {
        app.import({
          development: `vendor/numeral/locales/${locale}.js`,
          production: `vendor/numeral/min/locales/${locale}.min.js`
        }, {
          using: [{ transformation: 'amd', as: `numeral/${locale}` }]
        });
      }
    }
  },

  treeForVendor: function(/* vendorTree */) {
    let numeralPath = path.dirname(require.resolve('numeral'));
    let numeralTree = new Funnel(numeralPath, {
      include: ['numeral.js', 'locales/**/*', 'min/**/*'],
      destDir: 'numeral'
    });

    return numeralTree;
  },
};
