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.

26 lines
871 B

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const utils = require("../../utils");
  4. class EntryTransformer {
  5. constructor(_settings) {
  6. this._settings = _settings;
  7. }
  8. getTransformer() {
  9. return (entry) => this._transform(entry);
  10. }
  11. _transform(entry) {
  12. let filepath = entry.path;
  13. if (this._settings.absolute) {
  14. filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
  15. filepath = utils.path.unixify(filepath);
  16. }
  17. if (this._settings.markDirectories && entry.dirent.isDirectory()) {
  18. filepath += '/';
  19. }
  20. if (!this._settings.objectMode) {
  21. return filepath;
  22. }
  23. return Object.assign(Object.assign({}, entry), { path: filepath });
  24. }
  25. }
  26. exports.default = EntryTransformer;