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 VueCore Instance 2 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  2ec34eb8_958a_e78a_50f2_177bff9c3445["check-keycodes.ts"]
  a9349ba5_bc74_f03e_b748_41eb2dcc87a9["config"]
  2ec34eb8_958a_e78a_50f2_177bff9c3445 --> a9349ba5_bc74_f03e_b748_41eb2dcc87a9
  09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"]
  2ec34eb8_958a_e78a_50f2_177bff9c3445 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b
  8ffc8513_97a6_feaa_6bc2_e31c949e66cd["index.ts"]
  8ffc8513_97a6_feaa_6bc2_e31c949e66cd --> 2ec34eb8_958a_e78a_50f2_177bff9c3445
  style 2ec34eb8_958a_e78a_50f2_177bff9c3445 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 VueCore 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: VueCore, 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