ModuleParser

ModuleParser

new ModuleParser()

The ModuleParser is a utility class designed to loop through and iterate
on a directory and pull out of each .js file found, any classes or exports
that extend from GQLBase or a child of GQLBase.

Since:
  • 2.7.0
Source:

Methods

(static) ModuleParser()

A string denoting the directory on disk where ModuleParser should be
searching for its classes.

Source:

⌾⠀importClass(filePath) → {Object}

Given a file path, this method will attempt to import/require the
file in question and return the object it exported; whatever that
may be.

Since:
  • 2.7.0
Source:
Parameters:
Name Type Description
filePath string

a path to pass to require()

Returns:
Type:
Object

the object, or undefined, that was returned when
it was require()'ed.

(async, inner) walk(dir, filelist) → {Promise.<Array.<string>>}

Recursively walks a directory and returns an array of asbolute file paths
to the files under the specified directory.

Since:
  • 2.7.0
Source:
Parameters:
Name Type Description
dir string

string path to the top level directory to parse

filelist Array.<string>

an array of existing absolute file paths,
or if not parameter is supplied a default empty array will be used.

Returns:
Type:
Promise.<Array.<string>>

an array of existing absolute file paths
found under the supplied dir directory.

(inner) ⎆⠀constructor(directory)

The constructor

Source:
Parameters:
Name Type Description
directory string

a string path to a directory containing the
various GQLBase extended classes that should be gathered.