MCPcopy Index your code
hub / github.com/jetify-com/devbox / packageElementIndex

Method packageElementIndex

internal/devconfig/configfile/ast.go:355–360  ·  view source on GitHub ↗

packageElementIndex returns the index of a package from an array of versionedName strings.

(arr *hujson.Array, name string)

Source from the content-addressed store, hash-verified

353// packageElementIndex returns the index of a package from an array of
354// versionedName strings.
355func (*configAST) packageElementIndex(arr *hujson.Array, name string) int {
356 return slices.IndexFunc(arr.Elements, func(v hujson.Value) bool {
357 elemName, _ := parseVersionedName(v.Value.(hujson.Literal).String())
358 return elemName == name
359 })
360}
361
362func joinNameVersion(name, version string) string {
363 if version == "" {

Callers 1

removePackageElementMethod · 0.95

Calls 2

parseVersionedNameFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected