ignore-enoent.js 535 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.ignoreENOENTSync = exports.ignoreENOENT = void 0;
  4. const ignoreENOENT = async (p) => p.catch(er => {
  5. if (er.code !== 'ENOENT') {
  6. throw er;
  7. }
  8. });
  9. exports.ignoreENOENT = ignoreENOENT;
  10. const ignoreENOENTSync = (fn) => {
  11. try {
  12. return fn();
  13. }
  14. catch (er) {
  15. if (er?.code !== 'ENOENT') {
  16. throw er;
  17. }
  18. }
  19. };
  20. exports.ignoreENOENTSync = ignoreENOENTSync;
  21. //# sourceMappingURL=ignore-enoent.js.map