$process()

in base/processors/computePaths.js [40:72]


    $process(docs) {

      const {pathTemplateMap, outputPathTemplateMap} = initializeMaps(this.pathTemplates);

      docs.forEach(doc => {

        try {

          if ( !doc.path ) {
            const getPath = pathTemplateMap[doc.docType];
            if ( !getPath ) {
              log.warn(createDocMessage('No path template provided', doc));
            } else {
              doc.path = getPath(doc);
            }
          }

          if ( !doc.outputPath ) {
            const getOutputPath = outputPathTemplateMap[doc.docType];
            if ( !getOutputPath ) {
              log.warn(createDocMessage('No output path template provided', doc));
            } else {
              doc.outputPath = getOutputPath(doc);
            }
          }

        } catch(err) {
          throw new Error(createDocMessage('Failed to compute paths for doc', doc, err));
        }

        log.debug(createDocMessage('path: ' + doc.path + '; outputPath: ' + doc.outputPath, doc));
      });
    }