tasks/grunt-fontsmith.js
function expandToObject(input) {
    // If the input is a string, encapsulate it as an array
    var retObj = input;
    if (typeof retObj === 'string') {
      retObj = [input];
    }

    // If the retObj is an array
    if (Array.isArray(retObj)) {
      // Collect the inputs into an object
      var inputArr = retObj;
      retObj = {};

      // Iterate over the inputs
      inputArr.forEach(function (inputStr) {
        // Break down any brace exapansions
        var inputPaths = braceExpand(inputStr);

        // Iterate over the paths
        inputPaths.forEach(function (filepath) {
          // Grab the extension and save it under its key
          // TODO: Deal with observer pattern here.
          // TODO: Will probably go `classical` here
          var ext = path.extname(filepath).slice(1);
          retObj[ext] = filepath;
        });
      });
    }

    // Return the objectified src
    return retObj;
  }
function expandToObject(input) {
    // If the input is a string, encapsulate it as an array
    var retObj = input;
    if (typeof retObj === 'string') {
      retObj = [input];
    }

    // If the retObj is an array
    if (Array.isArray(retObj)) {
      // Collect the inputs into an object
      var inputArr = retObj;
      retObj = {};

      // Iterate over the inputs
      inputArr.forEach(function (inputStr) {
        // Break down any brace exapansions
        var inputPaths = braceExpand(inputStr);

        // Iterate over the paths
        inputPaths.forEach(function (filepath) {
          // Grab the extension and save it under its key
          // TODO: Deal with observer pattern here.
          // TODO: Will probably go `classical` here
          var ext = path.extname(filepath).slice(1);
          retObj[ext] = filepath;
        });
      });
    }

    // Return the objectified src
    return retObj;
  }
function expandToObject ( input ) { // If the input is a string, encapsulate it as an array var retObj = input ; if ( typeof retObj === 'string' ) { retObj = [ input ] ; } // If the retObj is an array if ( Array . isArray ( retObj ) ) { // Collect the inputs into an object var inputArr = retObj ; retObj = { } ; // Iterate over the inputs inputArr . forEach ( function ( inputStr ) { // Break down any brace exapansions var inputPaths = braceExpand ( inputStr ) ; // Iterate over the paths inputPaths . forEach ( function ( filepath ) { // Grab the extension and save it under its key // TODO: Deal with observer pattern here. // TODO: Will probably go `classical` here var ext = path . extname ( filepath ) . slice ( 1 ) ; retObj [ ext ] = filepath ; } ) ; } ) ; } // Return the objectified src return retObj ; }
Helper function for objectifying src into type-first
Helper function for objectifying src into type - first