Loads files from a given map and places them in that map's `loaded` field

@param {Object} map The map of labels to filenames
@param {!Object} options Load options
@return {Promise.<Array.<Object>>} The same map with a `loaded` field
populated with file contents
function load(map, options) {
  var promises = [];
  var loaded = {};
  var filename;

  options = options || {};

  for (var key in map) {
    if (map.hasOwnProperty(key)) {
      if (!map[key] || map[key].length === 0) {
        continue;
      }

      filename = map[key];
      if (!options.external) {
        filename = path.resolve(ROOT_DIR, filename);
      }

      promises.push(loadSingle(filename)
        .then((function (_key) {
          return function (data) {
            loaded[_key] = data;
          };
        })(key)));
    }
  }

  map.loaded = loaded;

  return Q.all(promises);
}