MCPcopy
hub / github.com/vuejs/core / toValidAssetId

Function toValidAssetId

packages/compiler-core/src/utils.ts:490–498  ·  view source on GitHub ↗
(
  name: string,
  type: 'component' | 'directive' | 'filter',
)

Source from the content-addressed store, hash-verified

488}
489
490export function toValidAssetId(
491 name: string,
492 type: 'component' | 'directive' | 'filter',
493): string {
494 // see issue#4422, we need adding identifier on validAssetId if variable `name` has specific character
495 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
496 return searchValue === '-' ? '_' : name.charCodeAt(replaceValue).toString()
497 })}`
498}
499
500// Check if a node contains expressions that reference current context scope ids
501export function hasScopeRef(

Callers 5

genAssetsFunction · 0.90
wrapFilterFunction · 0.90
resolveComponentTypeFunction · 0.90
buildDirectiveArgsFunction · 0.90
utils.spec.tsFile · 0.90

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected