analyze method

Future<List<Units>> analyze(
  1. String path
)

Analyzes the given path and returns the resolved unit results.

If the path is a file, it will be analyzed as a single file. If the path is a directory, it will be analyzed as a directory.

Implementation

Future<List<Units>> analyze(String path) async {
  final isFile = fs.isFileSync(path);
  final isDirectory = fs.isDirectorySync(path);

  if (!isFile && !isDirectory) {
    throw ArgumentError('Invalid path: $path');
  }

  if (isFile) {
    return [await _analyzeFile(path)];
  }

  return await _analyzeDirectory(path);
}