mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
refactor: Replace _.unset with delete (#7813)
This commit is contained in:
parent
dc96b9a876
commit
e39cdfdf02
@ -96,9 +96,9 @@ class PluginUninstall {
|
||||
_.pull(plugins, this.options.pluginName);
|
||||
if (_.isEmpty(plugins)) {
|
||||
if (isArrayPluginsObject) {
|
||||
_.unset(serverlessFileObj, 'plugins');
|
||||
delete serverlessFileObj.plugins;
|
||||
} else {
|
||||
_.unset(serverlessFileObj.plugins, 'modules');
|
||||
delete serverlessFileObj.plugins.modules;
|
||||
}
|
||||
}
|
||||
return fse.writeJson(serverlessFilePath, serverlessFileObj);
|
||||
|
||||
@ -145,13 +145,13 @@ const removeExistingArrayItem = (ymlFile, pathInYml, removeValue) =>
|
||||
_.pull(arrayProperty, removeValue);
|
||||
|
||||
if (_.isEmpty(arrayProperty)) {
|
||||
_.unset(currentNode, arrayPropertyName);
|
||||
delete currentNode[arrayPropertyName];
|
||||
pathInObjectTree.push(currentNode);
|
||||
for (let i = pathInObjectTree.length - 1; i > 0; i--) {
|
||||
if (Object.keys(pathInObjectTree[i]).length > 0) {
|
||||
break;
|
||||
}
|
||||
_.unset(pathInObjectTree[i - 1], pathInYmlArray[i - 1]);
|
||||
delete pathInObjectTree[i - 1][pathInYmlArray[i - 1]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user