Improve internal representation of validProviders

This commit is contained in:
Mariusz Nowak 2019-09-27 13:48:29 +02:00
parent aaf3e8b7ed
commit a3422d3663
No known key found for this signature in database
GPG Key ID: B1FBDA8A182B03F2

View File

@ -3,11 +3,11 @@
const userStats = require('../../utils/userStats');
// class wide constants
const validProviders = ['aws'];
const validProviders = new Set(['aws']);
// TODO: update to look like the list in the "create" plugin
// once more than one provider is supported
const humanReadableProvidersList = `"${validProviders}"`;
const humanReadableProvidersList = `"${Array.from(validProviders)}"`;
class Config {
constructor(serverless, options) {
@ -43,7 +43,7 @@ class Config {
validate() {
const provider = this.options.provider.toLowerCase();
if (validProviders.indexOf(provider) === -1) {
if (!validProviders.has(provider)) {
const errorMessage = [
`Provider "${provider}" is not supported.`,
` Supported providers are: ${humanReadableProvidersList}.`,