Closed wirthi closed 5 years ago
Great find and thanks!
Released in babel-plugin-transform-define@1.3.2
Published differences:
$ publish-diff -o babel-plugin-transform-define@1.3.1 -n babel-plugin-transform-define@1.3.2 --filter='lib/index.js'
Index: lib/index.js
===================================================================
--- lib/index.js babel-plugin-transform-define@1.3.1
+++ lib/index.js babel-plugin-transform-define@1.3.2
@@ -76,10 +76,10 @@
return traverse(obj).paths().filter(function (arr) {
return arr.length;
}).map(function (arr) {
return arr.join(".");
- }).sort(function (elem) {
- return elem.length;
+ }).sort(function (a, b) {
+ return b.length - a.length;
});
};
/**
The comparator function of Array.prototype.sort expects two arguments to compare (https://tc39.github.io/ecma262/#sec-array.prototype.sort)
The previous implementation used a 1-element comparator, which always returns the length of the first element. That this resulted in the correct ordering in a test is pure luck.