-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hi,
consider the code below.
As you can see, altering the disableLanguages array (removing an item) the patch method breaks the disableLanguages array
NOTE
the input is a part of a longer config file but, consider that I have checked the issue on the whole file. I also tried to change the spacing between elements in the disableLanguages array (["he", "hu", "zh", "nb", "da", "ro", "fi"], ['he', 'hu', 'zh', 'nb', 'da', 'ro', 'fi'], ["he","hu","zh","nb","da","ro","fi"], ['he','hu','zh','nb','da','ro','fi'], ... and so on ) with the same result
let tomlFileContent= 'baseUrl = "https://example.com/"
languageCode = "en-us"
languageLang = "en"
title = "this is the title"
DefaultContentLanguage = "en"
disableLanguages = ["he", "hu", "zh", "nb", "da", "ro", "fi"]'
value= parse(tomlFileContent)
console.log (value.disableLanguages)
## output [ "he", "hu", "zh", "nb", "da", "ro", "fi" ]
for (var i = 0; i < value.disableLanguages.length; i++) {
if (value.disableLanguages[i] === 'he') {
value.disableLanguages.splice(i, 1);
i--;
}
}
console.log (value.disableLanguages)
## output ["hu", "zh", "nb", "da", "ro", "fi"]
console.log (patch(tomlFileContent, value))
### output
baseUrl = "https://example.com/"
languageCode = "en-us"
languageLang = "en"
title = "this is the title"
DefaultContentLanguage = "en"
disableLanguages = ["he", "hu", "zh", "nb", "da", "ro", "fi" <---- BROKEN !!!!
Metadata
Metadata
Assignees
Labels
No labels