Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.js 1.3KB

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const async_1 = require("./providers/async");
  4. const stream_1 = require("./providers/stream");
  5. const sync_1 = require("./providers/sync");
  6. const settings_1 = require("./settings");
  7. exports.Settings = settings_1.default;
  8. function walk(directory, optionsOrSettingsOrCallback, callback) {
  9. if (typeof optionsOrSettingsOrCallback === 'function') {
  10. return new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
  11. }
  12. new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
  13. }
  14. exports.walk = walk;
  15. function walkSync(directory, optionsOrSettings) {
  16. const settings = getSettings(optionsOrSettings);
  17. const provider = new sync_1.default(directory, settings);
  18. return provider.read();
  19. }
  20. exports.walkSync = walkSync;
  21. function walkStream(directory, optionsOrSettings) {
  22. const settings = getSettings(optionsOrSettings);
  23. const provider = new stream_1.default(directory, settings);
  24. return provider.read();
  25. }
  26. exports.walkStream = walkStream;
  27. function getSettings(settingsOrOptions = {}) {
  28. if (settingsOrOptions instanceof settings_1.default) {
  29. return settingsOrOptions;
  30. }
  31. return new settings_1.default(settingsOrOptions);
  32. }