MCPcopy Index your code
hub / github.com/angular/angular / getLocalizeCall

Function getLocalizeCall

packages/localize/tools/test/source_file_utils_spec.ts:493–517  ·  view source on GitHub ↗
(code: string)

Source from the content-addressed store, hash-verified

491}
492
493function getLocalizeCall(code: string): NodePath<t.CallExpression> {
494 let callPaths: NodePath<t.CallExpression>[] = [];
495 babel.transformSync(code, {
496 code: false,
497 filename: 'test/file.js',
498 cwd: '/',
499 plugins: [
500 {
501 visitor: {
502 CallExpression(path) {
503 callPaths.push(path);
504 },
505 },
506 },
507 ],
508 });
509 const localizeCall = callPaths.find((p) => {
510 const callee = p.get('callee');
511 return callee.isIdentifier() && callee.node.name === '$localize';
512 });
513 if (!localizeCall) {
514 throw new Error(`$localize cannot be found in ${code}`);
515 }
516 return localizeCall;
517}

Callers 1

Calls 3

isIdentifierMethod · 0.80
getMethod · 0.65
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…