Skip to content

Commit 689344e

Browse files
authored
Fixed enumeration issues with for...in (#265)
1 parent 1ddece5 commit 689344e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

modules/import/jsonLogic.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ import moment from "moment";
88
// http://jsonlogic.com/
99

1010
// helpers
11-
Array.prototype.uniq = function() {
12-
return Array.from(new Set(this));
13-
};
14-
Array.prototype.to_object = function() {
15-
return this.reduce((acc, [f, fc]) => ({...acc, [f] : fc}), {});
16-
};
11+
Object.defineProperty(Array.prototype, "uniq", {
12+
enumerable: false,
13+
value: function () {
14+
return Array.from(new Set(this));
15+
}
16+
});
17+
Object.defineProperty(Array.prototype, "to_object", {
18+
enumerable: false,
19+
value: function () {
20+
return this.reduce((acc, [f, fc]) => ({ ...acc, [f]: fc }), {});
21+
}
22+
});
1723

1824
//meta is mutable
1925
export const loadFromJsonLogic = (logicTree, config) => {

0 commit comments

Comments
 (0)