Loads a single asset and sets the returned data to the `loaded` subobject
of a given resource map

Usage: helper.populateSingle(this.metadata.template, this.templates, 'slides')
helper.populateSingle(this.metadata.layout, this.templates, 'layout')

@param {string} filename The name and location of the file to load
@param {Object} destination The destination map to store the loaded data
@param {string} key The key to use for storing the loaded data in destination
@return {Promise}
function populateSingle(filename, destination, key) {
  return loadSingle(filename)
    .then(function (data) {
      if (data) {
        /**
         * If the key points to an array in the destination map, then
         * we should also append to an array in the `loaded` section
         * of the map.
         *
         * This is useful for style resources, where `external.style` may
         * refer to a list of resources to be loaded.
         */
        if (Object.prototype.toString.call(destination[key]) === '[object Array]') {
          destination.loaded[key] = destination.loaded[key] || [];
          destination.loaded[key].push(data);
        } else {
          destination.loaded[key] = data;
        }
      }
    });
}