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
  3a581f2e_1bcd_f00a_33d9_f882cc873e2a["cached()"]
  ce303fd5_0a15_37d7_872a_d1ca73ec7f6a["util.ts"]
  3a581f2e_1bcd_f00a_33d9_f882cc873e2a -->|defined in| ce303fd5_0a15_37d7_872a_d1ca73ec7f6a
  f52ebfff_75b5_7bf8_45f8_252324962c89["camelize()"]
  f52ebfff_75b5_7bf8_45f8_252324962c89 -->|calls| 3a581f2e_1bcd_f00a_33d9_f882cc873e2a
  6d1167ad_2aaf_2d1c_4c53_16d516c38a50["capitalize()"]
  6d1167ad_2aaf_2d1c_4c53_16d516c38a50 -->|calls| 3a581f2e_1bcd_f00a_33d9_f882cc873e2a
  a587bd34_03ac_bb90_72f1_334a6c30478e["hyphenate()"]
  a587bd34_03ac_bb90_72f1_334a6c30478e -->|calls| 3a581f2e_1bcd_f00a_33d9_f882cc873e2a
  style 3a581f2e_1bcd_f00a_33d9_f882cc873e2a 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

Defined In

Frequently Asked Questions

What does cached() do?
cached() is a function in the vue codebase, defined in src/shared/util.ts.
Where is cached() defined?
cached() is defined in src/shared/util.ts at line 169.
What calls cached()?
cached() is called by 3 function(s): camelize, capitalize, hyphenate.

Analyze Your Own Codebase

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

Try Supermodel Free