Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sort #1706

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions dist/bloodhound.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 2.0.0
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2018 Twitter, Inc. and other contributors; Licensed MIT
*/

(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("bloodhound", [ "jquery" ], function(a0) {
return root["Bloodhound"] = factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
root["Bloodhound"] = factory(jQuery);
root["Bloodhound"] = factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
Expand Down Expand Up @@ -151,7 +151,7 @@
noop: function() {}
};
}();
var VERSION = "0.11.1";
var VERSION = "2.0.0";
var tokenizers = function() {
"use strict";
return {
Expand Down Expand Up @@ -525,8 +525,12 @@
}
function getIntersection(arrayA, arrayB) {
var ai = 0, bi = 0, intersection = [];
arrayA = arrayA.sort();
arrayB = arrayB.sort();
arrayA = arrayA.sort(function(a, b) {
return a - b;
});
arrayB = arrayB.sort(function(a, b) {
return a - b;
});
var lenArrayA = arrayA.length, lenArrayB = arrayB.length;
while (ai < lenArrayA && bi < lenArrayB) {
if (arrayA[ai] < arrayB[bi]) {
Expand Down
6 changes: 3 additions & 3 deletions dist/bloodhound.min.js

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions dist/typeahead.bundle.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 2.0.0
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2018 Twitter, Inc. and other contributors; Licensed MIT
*/

(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("bloodhound", [ "jquery" ], function(a0) {
return root["Bloodhound"] = factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
root["Bloodhound"] = factory(jQuery);
root["Bloodhound"] = factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
Expand Down Expand Up @@ -151,7 +151,7 @@
noop: function() {}
};
}();
var VERSION = "0.11.1";
var VERSION = "2.0.0";
var tokenizers = function() {
"use strict";
return {
Expand Down Expand Up @@ -525,8 +525,12 @@
}
function getIntersection(arrayA, arrayB) {
var ai = 0, bi = 0, intersection = [];
arrayA = arrayA.sort();
arrayB = arrayB.sort();
arrayA = arrayA.sort(function(a, b) {
return a - b;
});
arrayB = arrayB.sort(function(a, b) {
return a - b;
});
var lenArrayA = arrayA.length, lenArrayB = arrayB.length;
while (ai < lenArrayA && bi < lenArrayB) {
if (arrayA[ai] < arrayB[bi]) {
Expand Down Expand Up @@ -922,10 +926,10 @@
define("typeahead.js", [ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
Expand Down
8 changes: 4 additions & 4 deletions dist/typeahead.bundle.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/typeahead.jquery.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*!
* typeahead.js 0.11.1
* typeahead.js 2.0.0
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* Copyright 2013-2018 Twitter, Inc. and other contributors; Licensed MIT
*/

(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("typeahead.js", [ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
Expand Down
6 changes: 3 additions & 3 deletions dist/typeahead.jquery.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/bloodhound/search_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ var SearchIndex = window.SearchIndex = (function() {
function getIntersection(arrayA, arrayB) {
var ai = 0, bi = 0, intersection = [];

arrayA = arrayA.sort();
arrayB = arrayB.sort();
arrayA = arrayA.sort(function(a, b) { return a - b; });
arrayB = arrayB.sort(function(a, b) { return a - b; });

var lenArrayA = arrayA.length, lenArrayB = arrayB.length;

Expand Down