metadata

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metadata defines a metadata struct for Javascript packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JavascriptPackageJSONMetadata

type JavascriptPackageJSONMetadata struct {
	Author       *Person   `json:"author"`
	Maintainers  []*Person `json:"maintainers"`
	Contributors []*Person `json:"contributors"`

	// FromNPMRepository field is annotated by the misc/from-npm annotator by parsing the lockfile
	// of the root-level directory. This field is used to indicate whether this package's dependency
	// was resolved from the official NPM registry during installation. If false, it means the package
	// was either installed from a local path, a git repository, or another private registry.
	// This is to identify name collisions between locally published packages and official NPM packages.
	FromNPMRepository bool
}

JavascriptPackageJSONMetadata holds parsing information for a javascript package.json file.

func ToStruct

ToStruct converts the JavascriptPackageJSONMetadata proto to a Metadata struct.

func (*JavascriptPackageJSONMetadata) SetProto

func (m *JavascriptPackageJSONMetadata) SetProto(p *pb.Package)

SetProto sets the JavascriptMetadata field in the Package proto.

type Person

type Person struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	URL   string `json:"url"`
}

Person represents a person field in a javascript package.json file.

func PersonFromString

func PersonFromString(s string) *Person

PersonFromString parses a string of the form "name <email> (url)" into a Person struct.

func (*Person) PersonString

func (p *Person) PersonString() string

PersonString produces a string format of Person struct in the format of "name <email> (url)"

func (*Person) UnmarshalJSON

func (p *Person) UnmarshalJSON(b []byte) error

UnmarshalJSON parses a JSON object or string into a Person struct.

Jump to

Keyboard shortcuts

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