Skip to content

Commit

Permalink
fix: respect options
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobiah committed May 26, 2020
1 parent 0200bf7 commit c9a665f
Show file tree
Hide file tree
Showing 3 changed files with 558 additions and 250 deletions.
9 changes: 6 additions & 3 deletions jsoncache.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ class JSONCache extends EventEmitter {
super();

// eslint-disable-next-line no-param-reassign
const {
parser, promiseLib, logger, delayStart, opts, maxListeners, useEmitter, maxRetry, integrity,
} = {
options = {
...defaultOpts,
...options,
};

const {
parser, promiseLib, logger, delayStart, opts, maxListeners, useEmitter, maxRetry, integrity,
} = options;

this.url = url;
// eslint-disable-next-line global-require
this.protocol = this.url.startsWith('https') ? require('https') : require('http');
Expand All @@ -62,6 +64,7 @@ class JSONCache extends EventEmitter {
this.opts = opts;
this.useEmitter = useEmitter;
this.integrity = integrity;

if (useEmitter) {
this.setMaxListeners(maxListeners);
}
Expand Down
Loading

0 comments on commit c9a665f

Please sign in to comment.