Skip to content

Commit

Permalink
fix(options): Add missing error messages
Browse files Browse the repository at this point in the history
- Add default value to printArray
  • Loading branch information
soft-decay committed Dec 2, 2020
1 parent 44b9a82 commit f5d0d39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function getUnsupportedVisibilitiesString(arr) {
const ErrorMessage = Object.freeze({
OptionsRequired: 'An options object is required.',
InputRequired: 'One of options.filename or options.fileContent is required.',
EncodingMissing: 'Internal Error: options.encoding is not set.',
EncodingFormat: ERROR_ENCODING_FORMAT + INFO_ENCODING_SUPPORTED,
EncodingNotSupported: (enc) => getUnsupportedEncodingString(enc),
IgnoredVisibilitiesMissing: 'Internal Error: options.ignoredVisibilities is not set.',
IgnoredVisibilitiesFormat: ERROR_VISIBILITIES_FORMAT + INFO_VISIBILITIES_SUPPORTED,
IgnoredVisibilitiesNotSupported: (arr) => `${getUnsupportedVisibilitiesString(arr)}`,
});
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const isTopLevelComment = (comment) => {

const isString = (x) => typeof x === 'string' || x instanceof String;

const printArray = (array) => array.map(s => `'${s}'`).join(', ');
const printArray = (array = []) => array.map(s => `'${s}'`).join(', ');

const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);

Expand Down

0 comments on commit f5d0d39

Please sign in to comment.