Skip to content

Commit

Permalink
Remove handling no native Promise constructor [major]
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Apr 30, 2023
1 parent f03ebcf commit 0866e6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
24 changes: 9 additions & 15 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ const yauzlOriginal = require('yauzl'),
cloner = require('yauzl-clone');

// Imports
const NativePromise = require('./promise.js'),
promisify = require('./promisify.js');
const promisify = require('./promisify.js');

// Exports

const NativePromise = Promise;

module.exports = use();

function use(Promise, yauzl, options) {
// Conform options
options = {clone: true, ...options};
Expand All @@ -31,23 +35,13 @@ function use(Promise, yauzl, options) {
}

// Add promisfied methods
if (Promise) {
promisify(yauzl, Promise);
} else {
yauzl = {};
}
promisify(yauzl, Promise);

// Add `use` methods
yauzl.use = use;
yauzl.usePromise = function(Promise) { // eslint-disable-line no-shadow
return use(Promise, null);
};
yauzl.useYauzl = function(yauzl, options) { // eslint-disable-line no-shadow
return use(null, yauzl, options);
};
yauzl.usePromise = Promise => use(Promise, null); // eslint-disable-line no-shadow
yauzl.useYauzl = (yauzl, options) => use(null, yauzl, options); // eslint-disable-line no-shadow

// Return yauzl object
return yauzl;
}

module.exports = use();
14 changes: 0 additions & 14 deletions lib/promise.js

This file was deleted.

0 comments on commit 0866e6e

Please sign in to comment.