Skip to content

Commit 9a25bce

Browse files
authored
Inline objToString and objKeys
There's a bug in `purs bundle` that's existed for many versions: purescript/purescript#3259. In this case, `purs bundle` does not keep `objKeys` or `objToString` around in the JS. To circumvent the bug, we inline the `var`s instead of extracting them.
1 parent ca4d80f commit 9a25bce

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Data/Argonaut/Core.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@ exports.stringify = function (j) {
1616
return JSON.stringify(j);
1717
};
1818

19-
var objToString = Object.prototype.toString;
20-
var objKeys = Object.keys;
21-
2219
function isArray(a) {
23-
return objToString.call(a) === "[object Array]";
20+
return Object.prototype.toString.call(a) === "[object Array]";
2421
}
2522

2623
exports._caseJson = function (isNull, isBool, isNum, isStr, isArr, isObj, j) {
2724
if (j == null) return isNull();
2825
else if (typeof j === "boolean") return isBool(j);
2926
else if (typeof j === "number") return isNum(j);
3027
else if (typeof j === "string") return isStr(j);
31-
else if (objToString.call(j) === "[object Array]")
28+
else if (Object.prototype.toString.call(j) === "[object Array]")
3229
return isArr(j);
3330
else return isObj(j);
3431
};
@@ -83,8 +80,8 @@ exports._compare = function _compare (EQ, GT, LT, a, b) {
8380
else if (typeof b === "string") return GT;
8481
else if (isArray(b)) return GT;
8582
else {
86-
var akeys = objKeys(a);
87-
var bkeys = objKeys(b);
83+
var akeys = Object.keys(a);
84+
var bkeys = Object.keys(b);
8885
if (akeys.length < bkeys.length) return LT;
8986
else if (akeys.length > bkeys.length) return GT;
9087
var keys = akeys.concat(bkeys).sort();

0 commit comments

Comments
 (0)