How to use the templateElement function from babel-types
Find comprehensive JavaScript babel-types.templateElement code examples handpicked from public code repositorys.
22 23 24 25 26 27 28 29 30 31
path.replaceWith( t.program([ t.expressionStatement( t.templateLiteral([ t.templateElement({ raw: printed }, true) ], []) ) ]) );
6
34
3
+ 11 other calls in file
214 215 216 217 218 219 220 221
return `&${item.key.name}=` }) expressions = expressionList.map(item => item.value) quasis = [ ...templateElementItemList, templateElementLastItem ].map(item => { return types.templateElement({ raw: item, cooked: item }, false) }) }
4
12
2
+ 19 other calls in file
42 43 44 45 46 47 48 49 50 51
} }, Import(path) { path.parent.arguments[0] = t.templateLiteral( [ t.templateElement({ raw: prefix, cooked: prefix, }), t.templateElement({ raw: '&namespace', cooked: '&namespace' }, true),
1
6
2
+ 39 other calls in file
37 38 39 40 41 42 43 44 45 46
if (t.isTemplateLiteral(first) && t.isStringLiteral(second)) { const quasi = first.quasis[first.quasis.length - 1]; const value = typeof quasi.value === 'string' ? { raw: quasi.value, cooked: quasi.value } : quasi.value; const quasis = first.quasis.slice(0); quasis[quasis.length - 1] = t.templateElement({ raw: value.raw + second.value, cooked: value.cooked + second.value, }); return t.templateLiteral(quasis, first.expressions.slice(0));
0
1
2
+ 41 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)