Code coverage report for src/js/base/core/key.js

# all files / src/js/base/core/ key.js

100% Statements 9/9
100% Branches 0/0
100% Functions 4/4
100% Lines 8/8

    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    921×
    1×
    1×
    1×
    1×

    1×

    3×

    2×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/src/js/base/core/key.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    var lists_1 = require("./lists");
    var func_1 = require("./func");
    var KEY_MAP = {
        'BACKSPACE': 8,
        'TAB': 9,
        'ENTER': 13,
        'SPACE': 32,
        'DELETE': 46,
        // Arrow
        'LEFT': 37,
        'UP': 38,
        'RIGHT': 39,
        'DOWN': 40,
        // Number: 0-9
        'NUM0': 48,
        'NUM1': 49,
        'NUM2': 50,
        'NUM3': 51,
        'NUM4': 52,
        'NUM5': 53,
        'NUM6': 54,
        'NUM7': 55,
        'NUM8': 56,
        // Alphabet: a-z
        'B': 66,
        'E': 69,
        'I': 73,
        'J': 74,
        'K': 75,
        'L': 76,
        'R': 82,
        'S': 83,
        'U': 85,
        'V': 86,
        'Y': 89,
        'Z': 90,
        'SLASH': 191,
        'LEFTBRACKET': 219,
        'BACKSLASH': 220,
        'RIGHTBRACKET': 221
    };
    /**
     * @class core.key
     *
     * Object for keycodes.
     *
     * @singleton
     * @alternateClassName key
     */
    exports["default"] = {
        /**
         * @method isEdit
         *
         * @param {Number} keyCode
         * @return {Boolean}
         */
        isEdit: function (keyCode) {
            return lists_1["default"].contains([
                KEY_MAP.BACKSPACE,
                KEY_MAP.TAB,
                KEY_MAP.ENTER,
                KEY_MAP.SPACE,
                KEY_MAP.DELETE,
            ], keyCode);
        },
        /**
         * @method isMove
         *
         * @param {Number} keyCode
         * @return {Boolean}
         */
        isMove: function (keyCode) {
            return lists_1["default"].contains([
                KEY_MAP.LEFT,
                KEY_MAP.UP,
                KEY_MAP.RIGHT,
                KEY_MAP.DOWN,
            ], keyCode);
        },
        /**
         * @property {Object} nameFromCode
         * @property {String} nameFromCode.8 "BACKSPACE"
         */
        nameFromCode: func_1["default"].invertObject(KEY_MAP),
        code: KEY_MAP
    };

    },'src/js/base/core/key.js',{"./lists":"/Users/lqez/Dev/summernote/src/js/base/core/lists.js","./func":"/Users/lqez/Dev/summernote/src/js/base/core/func.js"}];})(this);
    //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsia2V5LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaUNBQTRCO0FBQzVCLCtCQUEwQjtBQUUxQixJQUFNLE9BQU8sR0FBRztJQUNkLFdBQVcsRUFBRSxDQUFDO0lBQ2QsS0FBSyxFQUFFLENBQUM7SUFDUixPQUFPLEVBQUUsRUFBRTtJQUNYLE9BQU8sRUFBRSxFQUFFO0lBQ1gsUUFBUSxFQUFFLEVBQUU7SUFFWixRQUFRO0lBQ1IsTUFBTSxFQUFFLEVBQUU7SUFDVixJQUFJLEVBQUUsRUFBRTtJQUNSLE9BQU8sRUFBRSxFQUFFO0lBQ1gsTUFBTSxFQUFFLEVBQUU7SUFFVixjQUFjO0lBQ2QsTUFBTSxFQUFFLEVBQUU7SUFDVixNQUFNLEVBQUUsRUFBRTtJQUNWLE1BQU0sRUFBRSxFQUFFO0lBQ1YsTUFBTSxFQUFFLEVBQUU7SUFDVixNQUFNLEVBQUUsRUFBRTtJQUNWLE1BQU0sRU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