You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
837 B

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const async_1 = require("../readers/async");
  4. const provider_1 = require("./provider");
  5. class ProviderAsync extends provider_1.default {
  6. constructor() {
  7. super(...arguments);
  8. this._reader = new async_1.default(this._settings);
  9. }
  10. async read(task) {
  11. const root = this._getRootDirectory(task);
  12. const options = this._getReaderOptions(task);
  13. const entries = await this.api(root, task, options);
  14. return entries.map((entry) => options.transform(entry));
  15. }
  16. api(root, task, options) {
  17. if (task.dynamic) {
  18. return this._reader.dynamic(root, options);
  19. }
  20. return this._reader.static(task.patterns, options);
  21. }
  22. }
  23. exports.default = ProviderAsync;