PageSourceSearch

https://www.recruit-kantobus.jp/__customtemplate_common__/js/DBmodule/Sorter.js

js recruit-kantobus.jp collected 2026-09-26 05:18:35 UTC 1,806 bytes, 74 lines download raw bytes

1var Sorter = ( function () {
2    'use strict';
3
4    /**
5     * キー昇順でソートする
6     * @param {object} map キーバリューマップ
7     */
8    var ksort = function ( map ) {
9        var keys = Object.keys( map );
10
11        keys.sort();
12
13        return keys.reduce( function ( accumulator, key ) {
14            accumulator[ key ] = map[ key ];
15            return accumulator;
16        }, {} );
17    };
18
19    /**
20     * キー降順でソートする
21     * @param {object} map キーバリューマップ
22     */
23    var krsort = function ( map ) {
24        var
25            keys = Object.keys( map ),
26            reversed = keys.sort().reverse()
27        ;
28
29        return reversed.reduce( function ( accumulator, key ) {
30            accumulator[ key ] = map[ key ];
31            return accumulator;
32        }, {} );
33    };
34
35    /**
36     * 値昇順でソートする
37     * @param {object} map キーバリューマップ
38     */
39    var asort = function ( map ) {
40        var
41            flipedMap = flip( map ),
42            sorted    = ksort( flipedMap )
43        ;
44
45        return flip( sorted );
46    };
47
48    /**
49     * 値降順でソートする
50     * @param {object} map キーバリューマップ
51     */
52    var arsort = function ( map ) {
53        var
54            flipedMap = flip( map ),
55            sorted    = krsort( flipedMap )
56        ;
57
58        return flip( sorted );
59    }
60
61    var flip = function ( map ) {
62        return Object.keys( map ).reduce( function ( accumulator, key ) {
63            accumulator[ map[key] ] = key;
64            return accumulator;
65        }, {} );
66    };
67
68    return {
69        ksort  : ksort,
70        krsort : krsort,
71        asort  : asort,
72        arsort : arsort,
73    };
74} )();

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.