3
Copyright 2012 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
7
YUI.add('arraysort', function(Y) {
10
Provides a case-insenstive comparator which can be used for array sorting.
16
ISVALUE = LANG.isValue,
17
ISSTRING = LANG.isString;
20
Provides a case-insenstive comparator which can be used for array sorting.
28
Comparator function for simple case-insensitive sorting of an array of
32
@param a {Object} First sort argument.
33
@param b {Object} Second sort argument.
34
@param desc {Boolean} `true` if sort direction is descending, `false` if
35
sort direction is ascending.
36
@return {Boolean} -1 when a < b. 0 when a == b. 1 when a > b.
38
compare: function(a, b, desc) {
47
else if(!ISVALUE(b)) {
58
return (desc) ? 1 : -1;
61
return (desc) ? -1 : 1;
71
}, '3.5.0' ,{requires:['yui-base']});