Skip to content

Commit b5d1f1d

Browse files
filter array items
1 parent 397fedc commit b5d1f1d

File tree

3 files changed

+6
-3801
lines changed

3 files changed

+6
-3801
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const _ = require('lodash')
21
class serverlessPluginIfElse {
32
/**
43
*
@@ -111,10 +110,13 @@ class serverlessPluginIfElse {
111110
return;
112111
}
113112
}
114-
if (_.get(item, path[i])) {
113+
if (path[i] in item) {
115114
if (type == "remove") {
116115
this.serverless.cli.log(this.pluginName + " - Excluding: " + keyPath);
117-
_.unset(item, [path[i]]);
116+
delete item[path[i]];
117+
if (Array.isArray(item)) {
118+
item = item.filter(i => i);
119+
}
118120
} else if (type == "set") {
119121
item[path[i]] = newValue;
120122
if (typeof newValue == "object") {

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
"eslint": "^7.20.0",
2121
"jest": "^26.6.3"
2222
},
23-
"dependencies": {
24-
"lodash": "^4.17.21"
25-
},
23+
"dependencies": {},
2624
"repository": {
2725
"type": "git",
2826
"url": "git+https://github.com/anantab/serverless-plugin-ifelse.git"

0 commit comments

Comments
 (0)