file_path fields and methods
A field is a plain fact about the value, read with a dot and no brackets: $value.name. A method takes arguments or does work, and is called with ->: $value->name(arguments), or with the value piped in: $value |> name(arguments).
Fields
| Field | Type | Description |
|---|---|---|
.extension | string | The extension after the last dot, without the dot: pdf in ./reports/summary.pdf, or '' when there is none. |
.folder | file_path | The path of the folder it is in: ./reports for ./reports/summary.pdf, and null for ./ itself. |
.name | string | The last name, extension included: summary.pdf in ./reports/summary.pdf. |
.segments | list | The names in order, as written: ['.', 'reports', 'summary.pdf'] for ./reports/summary.pdf. |
.stem | string | The last name without its extension: summary in ./reports/summary.pdf, summary.final in summary.final.pdf. |
Methods from any
->convert(from?: 'json'|yaml|'csv'|'markdown'|'latex', to?: 'json'|yaml|'csv'|html|'markdown'|'latex', header?: bool, as?: type, headers?: list, indented?: bool)->from(type: 'json'|yaml|'csv'|'markdown'|'latex', header?: bool, as?: type)->is_a(type: word)->is_null()->or(fallback)->to(type: 'json'|yaml|'csv'|html|'markdown'|'latex', headers?: list, indented?: bool)->to_string()->type()
Methods from string
->contains(text, ignore_case?: bool)->count()->ends_with(text, ignore_case?: bool)->escape()->index_of(text, ignore_case?: bool, last?: bool)->lower()->markdown_escape()->matches(pattern: regex)->pad(width: number, char?, start?: bool)->replace(old, new, ignore_case?: bool)->slice(start: number, end?: number)->split(separator?)->starts_with(text, ignore_case?: bool)->truncate(length: number, suffix?)->upper()->url_encode()