jscode

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JscodeStreamParser

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

func DefaultJscodeStreamParser added in v1.1.3

func DefaultJscodeStreamParser() *JscodeStreamParser

DefaultJscodeStreamParser creates a new JavaScript code stream parser

func (*JscodeStreamParser) GetSupportedTypes

func (p *JscodeStreamParser) GetSupportedTypes() []string

GetSupportedTypes returns the supported file formats

func (*JscodeStreamParser) Parse

func (p *JscodeStreamParser) Parse(ctx context.Context, content []byte, metadata map[string]any) (*core.Document, error)

Parse implements core.Parser interface.

func (*JscodeStreamParser) ParseStream

func (p *JscodeStreamParser) ParseStream(ctx context.Context, r io.Reader, metadata map[string]any) (<-chan *core.Document, error)

ParseStream implements the core.Parser interface

func (*JscodeStreamParser) SetChunkOverlap

func (p *JscodeStreamParser) SetChunkOverlap(overlap int)

SetChunkOverlap sets the chunk overlap

func (*JscodeStreamParser) SetChunkSize

func (p *JscodeStreamParser) SetChunkSize(size int)

SetChunkSize sets the chunk size

func (*JscodeStreamParser) SetExtractClasses

func (p *JscodeStreamParser) SetExtractClasses(extract bool)

SetExtractClasses sets whether to extract classes

func (*JscodeStreamParser) SetExtractComments

func (p *JscodeStreamParser) SetExtractComments(extract bool)

SetExtractComments sets whether to extract comments

func (*JscodeStreamParser) SetExtractFunctions

func (p *JscodeStreamParser) SetExtractFunctions(extract bool)

SetExtractFunctions sets whether to extract functions

func (*JscodeStreamParser) Supports

func (p *JscodeStreamParser) Supports(contentType string) bool

type Parser

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

Parser implements a JavaScript code parser

func DefaultParser added in v1.1.3

func DefaultParser() *Parser

DefaultParser creates a new JavaScript parser

func (*Parser) Parse

func (p *Parser) Parse(ctx context.Context, r io.Reader) ([]core.Chunk, error)

Parse parses JavaScript code into chunks

func (*Parser) ParseWithCallback

func (p *Parser) ParseWithCallback(ctx context.Context, r io.Reader, callback func(core.Chunk) error) error

ParseWithCallback parses JavaScript code and calls the callback for each chunk

func (*Parser) SetChunkOverlap

func (p *Parser) SetChunkOverlap(overlap int)

SetChunkOverlap sets the chunk overlap

func (*Parser) SetChunkSize

func (p *Parser) SetChunkSize(size int)

SetChunkSize sets the chunk size

func (*Parser) SetExtractClasses

func (p *Parser) SetExtractClasses(extract bool)

SetExtractClasses sets whether to extract classes

func (*Parser) SetExtractComments

func (p *Parser) SetExtractComments(extract bool)

SetExtractComments sets whether to extract comments

func (*Parser) SetExtractFunctions

func (p *Parser) SetExtractFunctions(extract bool)

SetExtractFunctions sets whether to extract functions

func (*Parser) SupportedFormats

func (p *Parser) SupportedFormats() []string

Jump to

Keyboard shortcuts

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