angulardetector

package
v0.0.0-testrgm3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AngularDetector

type AngularDetector interface {
	// DetectAngular takes the content of a js file and returns true if the plugin is using Angular.
	DetectAngular(js []byte) bool
}

AngularDetector implements a check to see if a js file is using angular APIs.

type ContainsBytesDetector

type ContainsBytesDetector struct {
	Pattern []byte
}

ContainsBytesDetector is an AngularDetector that returns true if module.js contains the "pattern" string.

func (*ContainsBytesDetector) DetectAngular

func (d *ContainsBytesDetector) DetectAngular(moduleJs []byte) bool

DetectAngular returns true if moduleJs contains the byte slice d.pattern.

type DetectorsProvider

type DetectorsProvider interface {
	// ProvideDetectors returns a slice of AngularDetector.
	ProvideDetectors(ctx context.Context) []AngularDetector
}

DetectorsProvider can provide multiple AngularDetectors used for Angular detection.

type RegexDetector

type RegexDetector struct {
	Regex *regexp.Regexp
}

RegexDetector is an AngularDetector that returns true if the module.js content matches a regular expression.

func (*RegexDetector) DetectAngular

func (d *RegexDetector) DetectAngular(moduleJs []byte) bool

DetectAngular returns true if moduleJs matches the regular expression d.regex.

type SequenceDetectorsProvider

type SequenceDetectorsProvider []DetectorsProvider

SequenceDetectorsProvider is a DetectorsProvider that wraps a slice of other DetectorsProvider, and returns the first provided result that isn't empty.

func (SequenceDetectorsProvider) ProvideDetectors

func (p SequenceDetectorsProvider) ProvideDetectors(ctx context.Context) []AngularDetector

type StaticDetectorsProvider

type StaticDetectorsProvider struct {
	Detectors []AngularDetector
}

StaticDetectorsProvider is a DetectorsProvider that always returns a pre-defined slice of AngularDetector.

func (*StaticDetectorsProvider) ProvideDetectors

func (p *StaticDetectorsProvider) ProvideDetectors(_ context.Context) []AngularDetector

Jump to

Keyboard shortcuts

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