Skip to content

Commit

Permalink
check array length of discover options
Browse files Browse the repository at this point in the history
  • Loading branch information
vunb committed Sep 11, 2019
1 parent 4edbb95 commit f54bceb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/extensions/extensions-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ class ExtensionsManager extends EventEmitter {
this.availableExtensions = [];

let autodiscover = false;
if (this.kites.options.discover === 'undefined') {
if (typeof this.kites.options.discover === 'undefined') {
this.kites.options.discover = [false, 0];
} else if (typeof this.kites.options.discover === 'boolean') {
this.kites.options.discover = [this.kites.options.discover, 2, this.kites.options.appDirectory];
} else if (typeof this.kites.options.discover === 'string') {
this.kites.options.discover = [true, 2, this.kites.options.discover];
} else if (this.kites.options.discover.length < 2) {
throw new Error('Discover options as array requires at least 2 elements! Example: [true, 2]');
}

// autodiscover extensions
Expand Down

0 comments on commit f54bceb

Please sign in to comment.