How to use the toIdentifier function from @babel/types
Find comprehensive JavaScript @babel/types.toIdentifier code examples handpicked from public code repositorys.
GitHub: harrysolovay/parcel
138 139 140 141 142 143 144 145 146 147
// Re-crawl scope so we are sure to have all bindings. scope.crawl(); // Rename each binding in the top-level scope to something unique. for (let name in scope.bindings) { if (!name.startsWith('$' + t.toIdentifier(asset.id))) { let newName = getName(asset, 'var', name); rename(scope, name, newName); } }
0
2
2
+ 7 other calls in file
363 364 365 366 367 368 369 370 371 372
return { id, statements }; } generatePrefixedUid(scope, name = 'temp') { name = t.toIdentifier(name); let uid; let i = 0; do {
1
0
0
+ 6 other calls in file
347 348 349 350 351 352 353 354 355 356
generateUidIdentifier(name) { return t.identifier(this.generateUid(name)); } generateUid(name = "temp") { name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, ""); let uid; let i = 1; do {
0
1
1
+ 16 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)