lib.bend checks
raw source on the hub · import 0xbe30b4c12fa21816c2b0e099f42f766e/lib.bend as Lib
Path — small Unix-style path helpers for Bend. Publish entry for this package. Depends only on Base.
Paths are plain Base Strings. v1 uses '/' regardless of host platform. Path.segments/split discard empty slash-delimited components; normalize therefore collapses repeated slashes and removes a trailing slash (except for the root path). '.' and '..' are ordinary components in this light normalizer; this package does not touch the filesystem.
Base already provides String.split, String.join, String.append and String prefix/suffix queries. Path keeps those primitives and adds path-aware wrappers with root, basename, dirname and extension semantics.
1 import
import Base
Definitions
def Path.segments source · line 19 · raw
@path:String -> List<&2, String>
Non-empty Unix path components. Base provides String.split and List.filter; the predicate only removes boundary/repeated-slash empty components.
def Path.split source · line 22 · raw
@path:String -> List<&2, String>
def Path.is_absolute source · line 25 · raw
@path:String -> Bool
def Path.normalized_body source · line 34 · raw
@path:String -> String
def Path.normalize.body source · line 37 · raw
@body:String -> @absolute:Bool -> @empty:Bool -> String
def Path.normalize source · line 46 · raw
@+path:String -> String
def Path.join.empty source · line 50 · raw
@+a:String -> @+b:String -> @a_empty:Bool -> @b_empty:Bool -> String
def Path.join.if source · line 61 · raw
@+a:String -> @+b:String -> @absolute:Bool -> String
def Path.join source · line 68 · raw
@+a:String -> @+b:String -> String
def Path.join_all.go source · line 71 · raw
@xs:List<&2, String> -> @acc:String -> String
def Path.join_all source · line 78 · raw
@xs:List<&2, String> -> String
def Path.basename.go source · line 83 · raw
@xs:List<&2, String> -> @last:String -> String
def Path.basename source · line 90 · raw
@path:String -> String
def Path.dirname.parts source · line 93 · raw
@xs:List<&2, String> -> List<&2, String>
def Path.dirname.body source · line 102 · raw
@body:String -> @absolute:Bool -> @empty:Bool -> String
def Path.dirname source · line 115 · raw
@+path:String -> String
def Path.extension.body.if source · line 121 · raw
@suffix:String -> @empty:Bool -> String
def Path.extension.body.parts source · line 128 · raw
@parts:List<&2, String> -> String
def Path.extension.body source · line 135 · raw
@basename:String -> String
def Path.extension.if source · line 145 · raw
@+basename:String -> @hidden:Bool -> @has_dot:Bool -> String
def Path.extension source · line 154 · raw
@path:String -> String