JSDoc not recognizing exported function

359
December 24, 2016, at 5:40 PM

I'm making a node.js project, and work in Webstorm, where functions are usually highlighted in yellow. However in the following scenario, fnA is not recognized as a function in file b.

//file a.js
module.exports = fnA;
/**
 * Converts val to someOtherVal
 * @param val
 * @return someOtherVal
 */
function fnA( val ){
   //Do something with val....
   return someOtherVal
}
//file b.js
var fnA = requires('./a.js');
function fnB() {
  var c = fnA(3); //<- not recognized as a function
}

However if I wrap the function in a namespace, it works properly:

 //a.js
 module.exports = fnA;
/**
 * Converts val to someOtherVal
 * @param val
 * @memberof core
 */
function fnA( val ){
   //Do something with val....
   return someOtherVal
}
__________________________________________________
//b.js
/**
 * @namespace
 */
var core = {
   fnA : requires('./a.js')
}

function b() {
  var c = core.fnA(3); //Recognized as a function
}

I would like to avoid wrapping the function in a namespace - what is the proper way to jsdoc the function in the first example?

Rent Charter Buses Company
READ ALSO
two different project request json parse error

two different project request json parse error

I'm trying to do two different project requestI am request a using request module other project using express but json parse error in the express project

529
express or express-generator: do i need both?

express or express-generator: do i need both?

Just exploring nodejs and came across express; On the npm repository site https://www

469
Getting error while trying to login using Node.js and MongoDB

Getting error while trying to login using Node.js and MongoDB

I have an issueI have one login pannel when i am trying to login it by right username and password using Node

485