GithubHelp home page GithubHelp logo

brianmanden / csharp-typescript-class-convertor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swehassanahmed/csharp-typescript-class-convertor

1.0 1.0 0.0 65 KB

JavaScript 97.39% C# 1.16% TypeScript 1.45%

csharp-typescript-class-convertor's Introduction

csharp-typescript-class-convertor

csharp-typescript-class-convertor is a Node.js based library for converting classess from .Net into Angular 8 (TypeScript code)

Installation

npm i csharp-typescript-class-convertor --save-dev

In your JavaScript File

import ConvertProcess from "csharp-typescript-class-convertor";
import path from 'path';

var pathArray = [];
pathArray.push("path1")
pathArray.push("path2")

var destinationPath = 'toPath';
var config = {
    camelCase: false,
    usingDefaultInTsFile: false,    
    usingClass:true                 // to use class declaration true - use false for interface declaration
}

var excludedModels = [
    path.join('..','Models1','excludedFile.cs')
]
ConvertProcess.StartExecution(pathArray, destinationPath, config, excludedModels);

Note --> there is a testing file in the package called test.js that demonstrate how to use this package.

The first argument containing paths of the models that you want to upload.

The second one is the destination. If left undefined it will create DefaultFolder in the same project

The third parameter is config to specificy the camel case in converting property name and the default key word in exporting ts class

The fourth parameter is the excluded model...you need to use path.join(params paths) to exclude them

Angular Using

  1. Create a javascript file in assets

  2. Import the package inside of it and run the static function

  3. Write a package.json command to run the packge with node - node ./src/assets/convert.js

  4. Every time you want to run the file just write npm run <fileName.js>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

csharp-typescript-class-convertor's People

Contributors

brianmanden avatar hassanahmedt avatar swehassanahmed avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.