Skip to content

Commit

Permalink
core: filters set:obj:name:val or set:val:name
Browse files Browse the repository at this point in the history
  • Loading branch information
kapouer committed Dec 30, 2019
1 parent 119347b commit b638fec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/site/src/filters.js
Expand Up @@ -140,7 +140,13 @@ exports.unset = function(obj, what, ...list) {
};

exports.set = function(obj, what, name, val) {
if (obj == null || typeof obj != "object") return obj;
if (obj == null) {
obj = {};
}
if (typeof obj != "object") {
if (val === undefined) val = obj;
else return obj;
}
obj = Object.assign({}, obj);
obj[name] = val;
return obj;
Expand Down

0 comments on commit b638fec

Please sign in to comment.