tsFile

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TsFile

type TsFile struct {
	// contains filtered or unexported fields
}

TsFile holds information about a Typescript - TS file, with name and source code

func New

func New(filename string) *TsFile

New will create a new pointer to a TsFile with the given filename

Note that the given filename cannot contain information about the folderpath

func (*TsFile) AddCode

func (f *TsFile) AddCode(newSourceCode string)

AddCode will just append the given sourceCode to the file.

Note that a "\n" will be added as a prefix to the given code

func (*TsFile) Name

func (f *TsFile) Name() string

Name will return the name of the file, without the folderpath

func (*TsFile) Save

func (f *TsFile) Save(headerTitle, folder string) error

Save will take all the file information and save it to a real file in disk

Note that you need to pass the name of the library that generated it, in order to provide good debug information inside the generated file

The headerTitle param is used to fill the signature header, at the beginning of the file

func (*TsFile) SourceCode

func (f *TsFile) SourceCode(headerTitle string) []byte

SourceCode will build the file source code, including the file imports source code

Note that you need to pass the name of the library that generated it, in order to provide good debug information inside the generated file

The headerTitle param is used to fill the signature header, at the beginning of the file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL