Home / Function/ cached() — vue Function Reference

cached() — vue Function Reference

Architecture documentation for the cached() function in util.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  873ecd88_d60c_980f_e4d8_c465d6aa940c["cached()"]
  463921b4_0e8b_8e70_7164_e4a31b8fe393["buildRegex()"]
  463921b4_0e8b_8e70_7164_e4a31b8fe393 -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  a0dae001_ecb7_6b42_ca22_98c727b657f3["normalize()"]
  a0dae001_ecb7_6b42_ca22_98c727b657f3 -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  24f2ea89_a8d4_f927_5470_492649344855["autoCssTransition()"]
  24f2ea89_a8d4_f927_5470_492649344855 -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  6035f657_5899_1773_aa74_0b3c968a42fe["parseStyleText()"]
  6035f657_5899_1773_aa74_0b3c968a42fe -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  447f7b2d_d677_800e_b42e_db97e7d830a7["camelize()"]
  447f7b2d_d677_800e_b42e_db97e7d830a7 -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  4cc66a79_034b_1114_66f2_674d202356f6["capitalize()"]
  4cc66a79_034b_1114_66f2_674d202356f6 -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  e667d00b_a47f_c88a_e931_82b5917dddc2["hyphenate()"]
  e667d00b_a47f_c88a_e931_82b5917dddc2 -->|calls| 873ecd88_d60c_980f_e4d8_c465d6aa940c
  style 873ecd88_d60c_980f_e4d8_c465d6aa940c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/shared/util.ts lines 169–175

export function cached<R>(fn: (str: string) => R): (sr: string) => R {
  const cache: Record<string, R> = Object.create(null)
  return function cachedFn(str: string) {
    const hit = cache[str]
    return hit || (cache[str] = fn(str))
  }
}

Domain

Subdomains

Frequently Asked Questions

What does cached() do?
cached() is a function in the vue codebase.
What calls cached()?
cached() is called by 7 function(s): autoCssTransition, buildRegex, camelize, capitalize, hyphenate, normalize, parseStyleText.

Analyze Your Own Codebase

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

Try Supermodel Free