1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.scandirSync = exports.scandir = void 0;
|
4 | const settings_1 = require("./settings");
|
5 | const async = require("./providers/async");
|
6 | const sync = require("./providers/sync");
|
7 | function scandir(path, optionsOrSettingsOrCallback, callback) {
|
8 | if (typeof optionsOrSettingsOrCallback === 'function') {
|
9 | async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
10 | return;
|
11 | }
|
12 | async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
13 | }
|
14 | exports.scandir = scandir;
|
15 | function scandirSync(path, optionsOrSettings) {
|
16 | const settings = getSettings(optionsOrSettings);
|
17 | return sync.read(path, settings);
|
18 | }
|
19 | exports.scandirSync = scandirSync;
|
20 | function getSettings(settingsOrOptions = {}) {
|
21 | if (settingsOrOptions instanceof settings_1.Settings) {
|
22 | return settingsOrOptions;
|
23 | }
|
24 | return new settings_1.Settings(settingsOrOptions);
|
25 | }
|