src/index.js
function translate (content, contentTypes) {
  let output = {}
  content.forEach(each => {
    const base = path.parse(each.file).base
    if (base === 'index.md') {
      const type = each.dir.split('/').pop()
      const contentTypeTranslation = contentTypes.find(contentType => contentType[type])
      if (contentTypeTranslation && contentTypeTranslation[type]) {
        output[type] = contentTypeTranslation[type](content, type)
      }
    }
  })
  return output
}
function translate (content, contentTypes) {
  let output = {}
  content.forEach(each => {
    const base = path.parse(each.file).base
    if (base === 'index.md') {
      const type = each.dir.split('/').pop()
      const contentTypeTranslation = contentTypes.find(contentType => contentType[type])
      if (contentTypeTranslation && contentTypeTranslation[type]) {
        output[type] = contentTypeTranslation[type](content, type)
      }
    }
  })
  return output
}
function translate ( content , contentTypes ) { let output = { } content . forEach ( each => { const base = path . parse ( each . file ) . base if ( base === 'index.md' ) { const type = each . dir . split ( '/' ) . pop ( ) const contentTypeTranslation = contentTypes . find ( contentType => contentType [ type ] ) if ( contentTypeTranslation && contentTypeTranslation [ type ] ) { output [ type ] = contentTypeTranslation [ type ] ( content , type ) } } } ) return output }
Translate data based on content types
@param  {Array} file  List of contents
@return {Array}       Updated list of contents
Translate data based on content types