angulardetector

package
v0.0.0-kmdagger2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AlwaysAngularFakeInspector is an inspector that always returns `true, nil`
	AlwaysAngularFakeInspector = &FakeInspector{
		InspectFunc: func(p *plugins.Plugin) (bool, error) {
			return true, nil
		},
	}

	// NeverAngularFakeInspector is an inspector that always returns `false, nil`
	NeverAngularFakeInspector = &FakeInspector{
		InspectFunc: func(p *plugins.Plugin) (bool, error) {
			return false, nil
		},
	}
)

Functions

This section is empty.

Types

type FakeInspector

type FakeInspector struct {
	// InspectFunc is the function called when calling Inspect()
	InspectFunc func(p *plugins.Plugin) (bool, error)
}

FakeInspector is an inspector whose Inspect function can be set to any function.

func (*FakeInspector) Inspect

func (i *FakeInspector) Inspect(p *plugins.Plugin) (bool, error)

type Inspector

type Inspector interface {
	// Inspect open module.js and checks if the plugin is using Angular by matching against its source code.
	// It returns true if module.js matches against any of the detectors in angularDetectors.
	Inspect(p *plugins.Plugin) (bool, error)
}

Inspector can inspect a module.js and determine if it's an Angular plugin or not.

func ProvideService

func ProvideService() Inspector

type PatternsListInspector

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

PatternsListInspector matches module.js against all the specified patterns, in sequence.

func NewDefaultPatternsListInspector

func NewDefaultPatternsListInspector() *PatternsListInspector

NewDefaultPatternsListInspector returns a new *PatternsListInspector using defaultDetectors as detectors.

func (*PatternsListInspector) Inspect

func (i *PatternsListInspector) Inspect(p *plugins.Plugin) (isAngular bool, err error)

Jump to

Keyboard shortcuts

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