Home / File/ check-keycodes.ts — vue Source File

check-keycodes.ts — vue Source File

Architecture documentation for check-keycodes.ts, a typescript file in the vue codebase. 2 imports, 1 dependents.

File typescript CoreRuntime Instance 2 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  3133a22d_f06b_0166_cc39_df83de7f0f54["check-keycodes.ts"]
  7937fbf2_2517_3f42_44b3_0dbdf16af5de["config"]
  3133a22d_f06b_0166_cc39_df83de7f0f54 --> 7937fbf2_2517_3f42_44b3_0dbdf16af5de
  156bf2e1_8a13_f22d_5437_54f14bcef8fa["util"]
  3133a22d_f06b_0166_cc39_df83de7f0f54 --> 156bf2e1_8a13_f22d_5437_54f14bcef8fa
  8456d994_c5db_04c1_7466_74c5274c4133["index.ts"]
  8456d994_c5db_04c1_7466_74c5274c4133 --> 3133a22d_f06b_0166_cc39_df83de7f0f54
  style 3133a22d_f06b_0166_cc39_df83de7f0f54 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import config from 'core/config'
import { hyphenate, isArray } from 'shared/util'

function isKeyNotMatch<T>(expect: T | Array<T>, actual: T): boolean {
  if (isArray(expect)) {
    return expect.indexOf(actual) === -1
  } else {
    return expect !== actual
  }
}

/**
 * Runtime helper for checking keyCodes from config.
 * exposed as Vue.prototype._k
 * passing in eventKeyName as last argument separately for backwards compat
 */
export function checkKeyCodes(
  eventKeyCode: number,
  key: string,
  builtInKeyCode?: number | Array<number>,
  eventKeyName?: string,
  builtInKeyName?: string | Array<string>
): boolean | null | undefined {
  const mappedKeyCode = config.keyCodes[key] || builtInKeyCode
  if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
    return isKeyNotMatch(builtInKeyName, eventKeyName)
  } else if (mappedKeyCode) {
    return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  } else if (eventKeyName) {
    return hyphenate(eventKeyName) !== key
  }
  return eventKeyCode === undefined
}

Domain

Subdomains

Dependencies

  • config
  • util

Frequently Asked Questions

What does check-keycodes.ts do?
check-keycodes.ts is a source file in the vue codebase, written in typescript. It belongs to the CoreRuntime domain, Instance subdomain.
What functions are defined in check-keycodes.ts?
check-keycodes.ts defines 2 function(s): checkKeyCodes, isKeyNotMatch.
What does check-keycodes.ts depend on?
check-keycodes.ts imports 2 module(s): config, util.
What files import check-keycodes.ts?
check-keycodes.ts is imported by 1 file(s): index.ts.
Where is check-keycodes.ts in the architecture?
check-keycodes.ts is located at src/core/instance/render-helpers/check-keycodes.ts (domain: CoreRuntime, subdomain: Instance, directory: src/core/instance/render-helpers).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free