# all files / TypeScript.NET/source/System/Collections/Sorting/ KeySortedContext.js

81.58% Statements 31/38
62.07% Branches 18/29
100% Functions 7/7
93.55% Lines 29/31

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45

    1×
    1×
    1×
    1×

    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    17×
    17×
    17×
    17×

    1×
    85×
    85×
    34×
    51×
    51×
    3×
    48×

    1×

    1×
    1×
    1×

     /*!
     * @author electricessence / https://github.com/electricessence/
     * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md
     */
    var __extends = (this && this.__extends) || function (d, b) {
        for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    (function (factory) {
        Eif (typeof module === 'object' && typeof module.exports === 'object') {
            var v = factory(require, exports); Iif (v !== undefined) module.exports = v;
        }
        else if (typeof define === 'function' && define.amd) {
            define(["require", "exports", "../../Compare", "./SortContext", "../../Functions"], factory);
        }
    })(function (require, exports) {
        "use strict";
        var Values = require("../../Compare");
        var SortContext_1 = require("./SortContext");
        var Functions_1 = require("../../Functions");
        var KeySortedContext = (function (_super) {
            __extends(KeySortedContext, _super);
            function KeySortedContext(next, _keySelector, order, comparer) {
                Iif (order === void 0) { order = 1; }
                Iif (comparer === void 0) { comparer = Values.compare; }
                _super.call(this, next, comparer, order);
                this._keySelector = _keySelector;
            }
            KeySortedContext.prototype.compare = function (a, b) {
                var _ = this, ks = _._keySelector;
                if (!ks || ks == Functions_1.Functions.Identity)
                    return _super.prototype.compare.call(this, a, b);
                var d = Values.compare(ks(a), ks(b));
                if (d == 0 && _._next)
                    return _._next.compare(a, b);
                return _._order * d;
            };
            return KeySortedContext;
        }(SortContext_1.SortContext));
        exports.KeySortedContext = KeySortedContext;
        Object.defineProperty(exports, "__esModule", { value: true });
        exports.default = KeySortedContext;
    });
    //# sourceMappingURL=KeySortedContext.js.map