pathdistance

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package pathdistance provides utility functions that calculate distances and extract path values using distance values.

A path distance represents the number of directory levels from the end of a path to a parent directory. For instance, for the path `foo/bar/baz`, the following are the path distance values for different components:

baz: 0
bar: 1
foo: 2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DistanceFrom

func DistanceFrom(values []string, path string) int

DistanceFrom determines the path distance for any of the provided values. In other words, if any of the values are an element of the path, it returns the distance to that match.

func PathAt

func PathAt(path string, distance int) string

PathAt returns the remaining path given a path distance.

Types

This section is empty.

Jump to

Keyboard shortcuts

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