JSDoc Function Prototype
Posted: Tue Mar 27, 2012 8:01 pm
We have many instances where we expand the functionality of standard JavaScript class types...for example:
All prototypes generate a similar warning:
What is the proper way to annotate this using JSDocs to get rid of the warnings?
- Code: Select all
// Replicate a string 'n' number of times
String.prototype.replicate = function( n )
{
return new Array( isNaN( n ) ? 1 : n++ ).join( this )
}
All prototypes generate a similar warning:
The property replicate is undefined for the javascript type String.
What is the proper way to annotate this using JSDocs to get rid of the warnings?