Skip to content

Commit

Permalink
Fixes the list inside a File.ext YAML key pattern is not correctly pa…
Browse files Browse the repository at this point in the history
…rsed
  • Loading branch information
junaid18183 committed Aug 29, 2024
1 parent f59f07b commit 6abc558
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,22 @@ function createValuesObject(valuesFilePath) {
if (valuePathSplit.length > 1) {
// The value is inside an array
const arrayPrefix = utils.getArrayPrefix(valuePath);
let isPlainArray = true; // Assume it is plain until we prove the opposite
_.get(valuesJSON, arrayPrefix).forEach((e) => {
if (typeof e !== 'string') {
isPlainArray = false;
// Retrieve the value at arrayPrefix only if it's defined
const array = _.get(valuesJSON, arrayPrefix);
// Ensure array is actually defined and is an array
if (Array.isArray(array)) {
let isPlainArray = true; // Assume it is plain until we prove the opposite
array.forEach((e) => {
if (typeof e !== 'string') {
isPlainArray = false;
}
});
if (isPlainArray) {
value = array;
valuePath = arrayPrefix;
}
});
if (isPlainArray) {
value = _.get(valuesJSON, arrayPrefix);
valuePath = arrayPrefix;
} else {
console.error(`Expected array at ${arrayPrefix}, found ${typeof array}`);

Check warning on line 161 in lib/parser.js

View workflow job for this annotation

GitHub Actions / Verify

Unexpected console statement
}
}

Expand Down

0 comments on commit 6abc558

Please sign in to comment.