UNPKG

@query-key-gen/generator

Version:

Generated for [Vite](https://vitejs.dev)

33 lines (29 loc) 952 B
import ts from 'typescript'; import { ObjectLiteralExpressionFactory } from './ObjectLiteralExpressionFactory'; import { VariableDeclarationFactory, VariableDeclarationListFactory } from './VariableDeclarationFactory'; namespace QueryKeyStatementFactory { const factory = ts.factory; export const write = ( propertyAssignments: ts.PropertyAssignment[], keyName: string, factoryPrefix: string ) => { return factory.createVariableStatement( undefined, VariableDeclarationListFactory.write( [ VariableDeclarationFactory.write( keyName + factoryPrefix, ObjectLiteralExpressionFactory.write([...propertyAssignments]), true ) ], ts.NodeFlags.Const ) ); }; } export { QueryKeyStatementFactory };