UNPKG

@wroud/di-tools-codemod

Version:

@wroud/di-tools-codemod is a codemod utility that automates the migration of your codebase from Inversify to @wroud/di. It streamlines the transformation process, allowing for effortless and customizable transitions through configuration support.

14 lines 580 B
import { CONSTANTS } from "./constants.js"; export function createInjectableDecorator(j, dependencies) { const arrayExpression = j.arrayExpression(dependencies.map((dep) => { if (dep.multiple) { return j.arrayExpression([dep.type]); } return dep.type; })); const newCallExpression = j.callExpression(j.identifier(CONSTANTS.injectable), dependencies.length > 0 ? [j.arrowFunctionExpression([], arrayExpression)] : []); return j.decorator(newCallExpression); } //# sourceMappingURL=createInjectableDecorator.js.map