Code coverage report for asset-builder/lib/Dependency.js

Statements: 100% (9 / 9)      Branches: 100% (4 / 4)      Functions: 100% (3 / 3)      Lines: 100% (9 / 9)      Ignored: none     

All files » asset-builder/lib/ » Dependency.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42          1                 1 18 18 18                     1 17                 1 24    
/**
 * @module
 */
'use strict';
 
var _ = require('lodash');
 
/**
 * Dependency
 * creates an object to be consumed by external sources
 * @class
 * @param {String} name
 * @param {Object} dependency dependency options object
 */
var Dependency = module.exports = function(name, dependency) {
  this.type = Dependency.parseType(name);
  this.name = name;
  this.globs = [].concat(
    (dependency.vendor || []),
    (dependency.files  || [])
  );
};
 
/**
 * prependGlobs
 * Adds globs to the beginning of the Dependency's globs property
 * @param {Array} files Array of glob strings
 */
Dependency.prototype.prependGlobs = function(files) {
  this.globs = [].concat(files, this.globs);
};
 
/**
 * parseType
 *
 * @param {String} name
 * @return {String}
 */
Dependency.parseType = function(name) {
  return _.last(name.split('.'));
};