From 446c13d6c2d2744c6ebb5773785090bfdfc632ed Mon Sep 17 00:00:00 2001 From: Mac Date: Wed, 10 Nov 2021 18:16:24 +0530 Subject: [PATCH] add support for arrays --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 487200e..2c0969f 100644 --- a/index.js +++ b/index.js @@ -113,7 +113,11 @@ class serverlessPluginIfElse { if (path[i] in item) { if (type == "remove") { this.serverless.cli.log(this.pluginName + " - Excluding: " + keyPath); - delete item[path[i]]; + if (Array.isArray(item)) { + item.splice(parseInt(path[i]), 1); + } else { + delete item[path[i]]; + } } else if (type == "set") { item[path[i]] = newValue; if (typeof newValue == "object") {