Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit e12392a

Browse files
committed
Ensure orderByPriority always returns an array, fixes #172
1 parent 1384ddf commit e12392a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

angularfire.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// as normal, except that the changes are also sent to all other clients
66
// instead of just a server.
77
//
8-
// AngularFire 0.5
8+
// AngularFire 0.5.0
99
// http://angularfire.com
1010
// License: MIT
1111

@@ -37,6 +37,17 @@ angular.module("firebase").factory("$firebase", ["$q", "$parse", "$timeout",
3737
angular.module("firebase").filter("orderByPriority", function() {
3838
return function(input) {
3939
if (!input.$getIndex || typeof input.$getIndex != "function") {
40+
// If input is an object, map it to an array for the time being.
41+
var type = Object.prototype.toString.call(input);
42+
if (typeof input == "object" && type == "[object Object]") {
43+
var ret = [];
44+
for (var prop in input) {
45+
if (input.hasOwnProperty(prop)) {
46+
ret.push(input[prop]);
47+
}
48+
}
49+
return ret;
50+
}
4051
return input;
4152
}
4253

angularfire.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)