@@ -15,8 +15,12 @@ const enginesDirectories = [{
1515 path : path . join ( process . cwd ( ) , 'node_modules' )
1616} ] ;
1717
18- // given a path: return the engine name if the path points to a valid engine
19- // module directory, or false if it doesn't
18+ /**
19+ * Given a path: return the engine name if the path points to a valid engine
20+ * module directory, or false if it doesn't.
21+ * @param filePath
22+ * @returns Engine name if exists or FALSE
23+ */
2024function isEngineModule ( filePath ) {
2125 const baseName = path . basename ( filePath ) ;
2226 const engineMatch = baseName . match ( engineMatcher ) ;
@@ -118,6 +122,11 @@ function findEngineModulesInDirectory(dir) {
118122
119123const PatternEngines = Object . create ( {
120124
125+ /**
126+ * Load all pattern engines.
127+ * @param patternLabConfig
128+ * @memberof PatternEngines
129+ */
121130 loadAllEngines : function ( patternLabConfig ) {
122131 var self = this ;
123132
@@ -165,6 +174,12 @@ const PatternEngines = Object.create({
165174 logger . debug ( `Done loading engines` ) ;
166175 } ,
167176
177+ /**
178+ * Get engine name for pattern.
179+ * @memberof PatternEngines
180+ * @param pattern
181+ * @returns engine name matching pattern
182+ */
168183 getEngineNameForPattern : function ( pattern ) {
169184 // avoid circular dependency by putting this in here. TODO: is this slow?
170185 const of = require ( './object_factory' ) ;
@@ -192,6 +207,12 @@ const PatternEngines = Object.create({
192207 return 'mustache' ;
193208 } ,
194209
210+ /**
211+ * Get engine for pattern.
212+ * @memberof PatternEngines
213+ * @param pattern
214+ * @returns name of engine for pattern
215+ */
195216 getEngineForPattern : function ( pattern ) {
196217 if ( pattern . isPseudoPattern ) {
197218 return this . getEngineForPattern ( pattern . basePattern ) ;
@@ -201,7 +222,11 @@ const PatternEngines = Object.create({
201222 }
202223 } ,
203224
204- // combine all found engines into a single array of supported extensions
225+ /**
226+ * Combine all found engines into a single array of supported extensions.
227+ * @memberof PatternEngines
228+ * @returns Array all supported file extensions
229+ */
205230 getSupportedFileExtensions : function ( ) {
206231 const engineNames = Object . keys ( PatternEngines ) ;
207232 const allEnginesExtensions = engineNames . map ( ( engineName ) => {
@@ -210,22 +235,38 @@ const PatternEngines = Object.create({
210235 return [ ] . concat . apply ( [ ] , allEnginesExtensions ) ;
211236 } ,
212237
238+ /**
239+ * Check if fileExtension is supported.
240+ * @memberof PatternEngines
241+ * @param fileExtension
242+ * @returns Boolean
243+ */
213244 isFileExtensionSupported : function ( fileExtension ) {
214245 const supportedExtensions = PatternEngines . getSupportedFileExtensions ( ) ;
215246 return ( supportedExtensions . lastIndexOf ( fileExtension ) !== - 1 ) ;
216247 } ,
217248
218- // given a filename, return a boolean: whether or not the filename indicates
219- // that the file is pseudopattern JSON
249+ /**
250+ * Given a filename, return a boolean: whether or not the filename indicates
251+ * that the file is pseudopattern JSON
252+ * @param filename
253+ * @return boolean
254+ */
220255 isPseudoPatternJSON : function ( filename ) {
221256 const extension = path . extname ( filename ) ;
222257 return ( extension === '.json' && filename . indexOf ( '~' ) > - 1 ) ;
223258 } ,
224259
225- // takes a filename string, not a full path; a basename (plus extension)
226- // ignore _underscored patterns, dotfiles, and anything not recognized by a
227- // loaded pattern engine. Pseudo-pattern .json files ARE considered to be
228- // pattern files!
260+ /**
261+ * Takes a filename string, not a full path; a basename (plus extension)
262+ * ignore _underscored patterns, dotfiles, and anything not recognized by a
263+ * loaded pattern engine. Pseudo-pattern .json files ARE considered to be
264+ * pattern files!
265+ *
266+ * @memberof PatternEngines
267+ * @param filename
268+ * @returns boolean
269+ */
229270 isPatternFile : function ( filename ) {
230271 // skip hidden patterns/files without a second thought
231272 const extension = path . extname ( filename ) ;
0 commit comments