All files / src handle-export-named-declaration.js

100% Statements 15/15
100% Branches 10/10
100% Functions 3/3
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27        7x 7x 6x 6x   7x 4x   3x 2x 2x   1x 1x   1x         2x    
function handleExportNamedDeclaration(insertKeyFunc, debug, { declaration, specifiers }) {
  let name
  let type
  let id
  debug(`DECLERATION FROM EXPROT NAMED IS :${JSON.stringify(declaration)}`)
  if(declaration){
    type = declaration.type
    id = declaration.id
  }
  if(declaration && declaration.declarations){
    return declaration.declarations.map(dec=>insertKeyFunc(dec.id.name, true))
  }
  if ( type && type === 'FunctionDeclaration' ) {
    name = id.name
    return insertKeyFunc(name, true)
  }else {
    try{
      specifiers.map(spec=>insertKeyFunc(spec.exported.name, true))
    }catch(e){
      debug(`error in handleExportNamed:${e}`)
    }
  }
}
 
module.exports = {
  handleExportNamedDeclaration
}