projects
/
horde.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
554c9cc
)
Add Array.numericSort().
author
Jan Schneider
<jan@horde.org>
Mon, 22 Nov 2010 18:20:09 +0000
(19:20 +0100)
committer
Jan Schneider
<jan@horde.org>
Mon, 22 Nov 2010 18:20:09 +0000
(19:20 +0100)
horde/js/horde-jquery.js
patch
|
blob
|
history
diff --git
a/horde/js/horde-jquery.js
b/horde/js/horde-jquery.js
index
324fc2d
..
b74a9fe
100644
(file)
--- a/
horde/js/horde-jquery.js
+++ b/
horde/js/horde-jquery.js
@@
-76,4
+76,13
@@
Number.prototype.toPaddedString = function(len,pad)
return str;
};
-String.prototype.toPaddedString = Number.prototype.toPaddedString;
\ No newline at end of file
+String.prototype.toPaddedString = Number.prototype.toPaddedString;
+
+Array.prototype.numericSort = function()
+{
+ return $.map(this, function(n) {
+ return new Number(n);
+ }).sort(function(a, b) {
+ return (a > b) ? 1 : ((a < b) ? -1 : 0);
+ });
+}