codeswapcore
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

CodeSwapCore

https://img.shields.io/badge/License-MIT-yellow.svg

https://img.shields.io/badge/TypeScript-Ready-blue.svg

https://img.shields.io/badge/JavaScript-ES5-yellow.svg

CodeSwapCore is a TypeScript and JavaScript-based library that utilizes the OpenAI API to convert code from one programming language to another. It supports various code patterns such as class, interface, record, and more.

Installation

npm install codeswapcore

Usage

Please note that you should replace 'YOUR_OPENAI_API_KEY' with your actual OpenAI API key.

import { TranformCode, ConfigureKey, CodePatterns } from 'codeswapcore';
import { ProgrammingLanguages } from 'codeswapcore';

// Configure your OpenAI API key
ConfigureKey('YOUR_OPENAI_API_KEY');

// Define your initial code and specify the target language and code pattern
const initCode = `...`;
const targetLanguage = ProgrammingLanguages.Ruby;
const pattern = CodePatterns.Class;

// Transform the code
TranformCode(initCode, targetLanguage, pattern)
  .then(newCode => {
    console.log('Transformed code:', newCode);
  })
  .catch(error => {
    console.error('Error:', error);
  });

License

CodeSwapCore is released under the MIT License.

Contributing

If you want to contribute to the project, you can do the following:

  • Report bugs or suggest improvements using the GitHub issues system.
  • Propose new features or improve documentation using pull requests.

License

This project is distributed under the MIT license. See the LICENSE file for more details.

If you find useful, consider supporting the project by making a donation via PayPal:

Support in Paypal ♥️

Package Sidebar

Install

npm i codeswapcore

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

25.9 kB

Total Files

12

Last publish

Collaborators

  • alfredoagrar