PageSourceSearch

https://micekorea.or.kr/weven_service/asset/js/bm2/util/Sort.js

js micekorea.or.kr collected 2026-10-06 09:07:10 UTC 1,673 bytes, 59 lines download raw bytes

1/**
2
3 * User: kjh
4 * Date: 13. 5. 21
5 * Time: 오후 12:17
6 * 아래의 소스는 WEVEN에 저작권이 있으므로 무단 사용 및 재 배포를 금합니다.
7 */
8
9
10bm.sort = {
11
12    /* 호출방법 : bm.sort.orderBy( "parentKey", "seq" ) */
13    byProps : function () {
14
15        function dynamicSort(property) {
16            return function (obj1,obj2) {
17                return obj1[property] > obj2[property] ? 1
18                    : obj1[property] < obj2[property] ? -1 : 0;
19            }
20        }
21
22        var props = arguments;
23        return function (obj1, obj2) {
24            var i = 0, result = 0, numberOfProperties = props.length;
25            while(result === 0 && i < numberOfProperties) {
26                result = dynamicSort(props[i])(obj1, obj2);
27                i++;
28            }
29            return result;
30        }
31    }
32
33    /* 호출방법 : bm.sort.orderBy( "parentKey asc", "seq asc" ... ) */
34    ,orderBy : function() {
35
36        function cmp(x, y) {
37            return x > y ? 1 : x < y ? -1 : 0;
38        }
39
40        //var args = [].map.call(arguments, function(a) {
41        //    var m = a.split(/\s+/);
42        //    return [m[0], m[1] == 'asc' ? 1 : -1]
43        //});
44
45        var args = [];
46        $.each(arguments, function( index, a ) {
47            var m = a.split(/\s+/);
48            args.push( [m[0], m[1] == 'asc' ? 1 : -1] );
49        });
50
51        return function(x, y) {
52            for (var i = 0; i < args.length; i++) {
53                var a = args[i], c = cmp(x[a[0]], y[a[0]]);
54                if (c) return c * a[1];
55            }
56            return 0;
57        }
58    }
59}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.