Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// remove some strings, prue string manipulation.
var text = data.substring(data.indexOf("{") + 1, data.indexOf("}")).replace(/ /g,"").replace(/(?:\r\n|\r|\n)/g, "").trim();
// fill the appSettingsTsKeys array with the appSettings.d.ts keys.
getappSettingsTsKeys(text, appSettingsTsKeys);
// now we have two arrays with keys to compare.
// checks the appSettings.json for missing keys.
var l = appSettingsTsKeys.length;
while(l--) {
if(appSettingsJsKeys.indexOf(appSettingsTsKeys[l]) === -1)
{
build.error(`Key \"${appSettingsTsKeys[l]}\" not found in appSettings.json, but exists in appSettings.d.ts. Please fix your appSettings.`);
return reject();
}
}
// checks the appSettings.d.ts for missing keys.
l = appSettingsJsKeys.length;
while(l--) {
if(appSettingsTsKeys.indexOf(appSettingsJsKeys[l]) === -1)
{
build.error(`Key \"${appSettingsJsKeys[l]}\" not found in appSettings.d.ts, but exists in appSettings.json. Please fix your appSettings.`);
return reject();
}
}
return resolve();