MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / isValidLocal

Function isValidLocal

packages/vite/hmr/helpers/ast-normalizer.ts:112–118  ·  view source on GitHub ↗
(n: string)

Source from the content-addressed store, hash-verified

110 const isCore = isCoreLike(path.node.source?.value as string);
111 // Ensure any generated binding names are valid identifiers and not reserved like 'this'
112 const isValidLocal = (n: string) => {
113 try {
114 return t.isValidIdentifier(n) && n !== 'this';
115 } catch {
116 return /^[A-Za-z_$][\w$]*$/.test(n) && n !== 'this';
117 }
118 };
119 const makeUniqueLocal = (base: string) => {
120 let name = base;
121 if (!isValidLocal(name)) {

Callers 1

makeUniqueLocalFunction · 0.85

Calls 1

testMethod · 0.45

Tested by

no test coverage detected