SushiScriptCore 1.1.1
See the version list below for details.
dotnet add package SushiScriptCore --version 1.1.1
NuGet\Install-Package SushiScriptCore -Version 1.1.1
<PackageReference Include="SushiScriptCore" Version="1.1.1" />
<PackageVersion Include="SushiScriptCore" Version="1.1.1" />
<PackageReference Include="SushiScriptCore" />
paket add SushiScriptCore --version 1.1.1
#r "nuget: SushiScriptCore, 1.1.1"
#:package SushiScriptCore@1.1.1
#addin nuget:?package=SushiScriptCore&version=1.1.1
#tool nuget:?package=SushiScriptCore&version=1.1.1
Sushi
Library for converting .NET classes to script language classes.<br><br> Currently supports
Author <br> Jeroen Vorsselman @ 2023
Main features
- Support for nested generic types.
- Support for .NET Core.
- Vastly improved compared to its predecessor.
- Creates extended classes and their constructors.
- Simple object mapping.
- Improved type dependency tree ordering.
- Adds documentation from the XML file generated using MS build.
- 95% Code coverage.
How to use
Script models are discovered in the Assembly.ExportedTypes. These classes must be decorated with the ConvertToScriptAttribute or by inherit from the IScriptModel interface and can be ignored using the IgnoreForScriptAttribute.
<br>
Create an instance of the SushiConverter using the given types or assembly and invoke the target script language method to create a converter.
Example
// 1) Get the assembly with the exported types.
var assembly = typeof(PersonViewModel).Assembly;
var converter = new SushiConverter(assembly).UseDocumentation(XmlDocPath);
// 2) Specify conversion options.
var options = new ConverterOptions(excludeComments: true);
// 3) Specify the target language and invoke ToString().
var script = converter.TypeScript(options).ToString();
// 4) The resulting script can be written to a file(stream).
WriteToFile(script, GetFilePath("models.no-comments.ts"));
Typescript result
/**
* Simple model to verify complex types.
* @typedef {Object} TypeModel
* @extends ViewModel
*/
export class TypeModel extends ViewModel {
/** A nullable boolean. */
nullableBool!: boolean | null;
/** A nullable string, defaults to null. */
nullableString!: string;
/** A DateTime instance. */
date: Date | string | null = null;
student: StudentViewModel = new StudentViewModel();
students: Array<StudentViewModel> = [];
studentPerClass: Array<Array<StudentViewModel>> = [];
/** A readonly string. */
readonlyString!: string;
constructor(value?: any) {
super(value);
if (value) {
this.nullableBool = value.nullableBool;
this.nullableString = value.nullableString;
this.guid = value.guid;
this.date = value.date;
this.student = value.student;
this.students = value.students;
this.studentPerClass = value.studentPerClass;
this.createdOn = value.createdOn;
this.readonlyString = value.readonlyString;
}
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.2 | 211 | 12/2/2024 |
| 1.5.1 | 1,108 | 8/30/2024 |
| 1.5.0 | 186 | 6/2/2024 |
| 1.5.0-alpha.2 | 82 | 6/2/2024 |
| 1.5.0-alpha | 107 | 6/2/2024 |
| 1.4.1 | 204 | 5/27/2024 |
| 1.4.0 | 188 | 5/27/2024 |
| 1.3.1 | 249 | 3/25/2024 |
| 1.3.0 | 239 | 3/25/2024 |
| 1.2.5 | 977 | 11/11/2023 |
| 1.2.4 | 463 | 11/11/2023 |
| 1.2.3 | 433 | 11/10/2023 |
| 1.2.2 | 450 | 11/10/2023 |
| 1.2.1 | 435 | 11/8/2023 |
| 1.2.0 | 453 | 11/8/2023 |
| 1.1.6 | 702 | 10/4/2023 |
| 1.1.5 | 732 | 8/16/2023 |
| 1.1.4 | 631 | 8/15/2023 |
| 1.1.3 | 714 | 5/16/2023 |
| 1.1.2 | 691 | 5/15/2023 |
| 1.1.1 | 686 | 5/15/2023 |
| 1.1.0 | 697 | 5/15/2023 |
| 1.0.9 | 787 | 5/10/2023 |
| 1.0.8 | 694 | 5/10/2023 |
| 1.0.7 | 686 | 5/10/2023 |
| 1.0.6 | 726 | 5/10/2023 |
| 1.0.5 | 839 | 1/14/2023 |
| 1.0.4 | 875 | 1/14/2023 |
| 1.0.3 | 854 | 1/12/2023 |
| 1.0.2 | 883 | 1/5/2023 |
| 1.0.1 | 834 | 1/5/2023 |
| 1.0.0 | 870 | 1/3/2023 |
- Simplified library interface > "new SushiConverter().ECMAScript6().Convert().ToString()".
- Support for ECMAScript 5, ECMAScript 6 and TypeScript.
- Classes have a simple object mapper "mapFrom", using Object.assign and _.extend for ES5.
- Improved type dependency tree ordering.
- Support for TypeScript enums.
- Improved conversion for data types.