{"id":21974691,"url":"https://github.com/parser3/als.path","last_synced_at":"2026-02-11T06:34:19.939Z","repository":{"id":56946313,"uuid":"73104241","full_name":"parser3/als.path","owner":"parser3","description":"Path Component.","archived":false,"fork":false,"pushed_at":"2016-12-01T08:03:27.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-02T18:47:46.263Z","etag":null,"topics":["als","package","parser3"],"latest_commit_sha":null,"homepage":null,"language":"OpenEdge ABL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parser3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-07T17:36:03.000Z","updated_at":"2016-11-07T17:57:49.000Z","dependencies_parsed_at":"2022-08-21T07:20:56.766Z","dependency_job_id":null,"html_url":"https://github.com/parser3/als.path","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/parser3/als.path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parser3%2Fals.path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parser3%2Fals.path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parser3%2Fals.path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parser3%2Fals.path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parser3","download_url":"https://codeload.github.com/parser3/als.path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parser3%2Fals.path/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29328261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["als","package","parser3"],"created_at":"2024-11-29T15:47:14.121Z","updated_at":"2026-02-11T06:34:19.925Z","avatar_url":"https://github.com/parser3.png","language":"OpenEdge ABL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Als/Path\n\nPath Component.\n\n---\n\n## Documentations\n\n### Properties\n\n* [$delimiter](#property-delimiter)\n* [$separator](#property-separator)\n* [$cwd](#property-cwd)\n\n---\n\n### Methods\n\n* [@basename](#method-basename)\n* [@dirname](#method-dirname)\n* [@extname](#method-extname)\n* [@format](#method-format)\n* [@isAbsolute](#method-isAbsolute)\n* [@join](#method-join)\n* [@normalize](#method-normalize)\n* [@parse](#method-parse)\n* [@relative](#method-relative)\n* [@resolve](#method-resolve)\n\n\n--------------------------------------------------------------------------------\n\n## $PROPERTY: delimiter\n\nProvides the path delimiter.\n\n---\n\n#### Example\n\n```ruby\n${Als/Path:delimiter}\n#--\u003e ':'\n\n\n$env:PATH\n#--\u003e '/usr/local/bin:/usr/bin:/bin'\n\n\n$paths[^env:PATH.split[${Als/Path:delimiter};h]]\n#--\u003e |/usr/local/bin|/usr/bin|/bin|\n```\n\n--------------------------------------------------------------------------------\n\n## $PROPERTY: separator\n\nProvides the path segment separator.\n\n---\n\n#### Example\n\n```ruby\n${Als/Path:separator}\n#--\u003e '/'\n\n\n$path[/assets/images/icons.png]\n$parts[^path.split[${Als/Path:separator};h]]\n#--\u003e |assets|images|icons.png|\n```\n\n--------------------------------------------------------------------------------\n\n## $PROPERTY: cwd\n\nContains the absolute path of the 'DOCUMENT_ROOT'.\n\n---\n\n#### Example\n\n```ruby\n${Als/Path:cwd}\n#--\u003e '/home/username/host/www'\n```\n\n--------------------------------------------------------------------------------\n--------------------------------------------------------------------------------\n\n## @METHOD: basename\n\nThe `^Als/Path:basename[]` methods returns the last portion of a `path`, similar to the Unix `basename` command.\n\n---\n\n### Syntax\n\n`^Als/Path:basename[path[;ext]]`\n\n### Params\n\n* $path `\u003cstring\u003e`\n* $ext `\u003cstring\u003e` An optional file extension.\n\n### Example\n\n```ruby\n^Als/Path:basename[/foo/bar/baz/asdf/quux.html]\n#--\u003e 'quux.html'\n\n\n^Als/Path:basename[/foo/bar/baz/asdf/quux.html;.html]\n#--\u003e 'quux'\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: dirname\n\nThe `^Als/Path:dirname[]` method returns the directory name of a `path`, similar to the Unix `dirname` command.\n\n---\n\n### Syntax\n\n`^Als/Path:dirname[path]`\n\n### Params\n\n* $path `\u003cstring\u003e`\n\n### Example\n\n```ruby\n^Als/Path:dirname[/foo/bar/baz/asdf/quux]\n#--\u003e '/foo/bar/baz/asdf'\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: extname\n\nThe `^Als/Path:extname[]` method returns the extension of the `path`, from the last occurance of the `.` (period) character to end of string in the last portion of the `path`. If there is no `.` in the last portion of the `path`, or if the first character of the basename of `path` (see [`^Als/Path:basename[]`](#method-basename)) is `.`, then an empty string is returned.\n\n---\n\n### Syntax\n\n`^Als/Path:extname[path]`\n\n### Params\n\n* $path `\u003cstring\u003e`\n\n### Example\n\n```ruby\n^Als/Path:extname[index.html]\n#--\u003e '.html'\n\n\n^Als/Path:extname[index.coffee.md]\n#--\u003e '.md'\n\n\n^Als/Path:extname[index.]\n#--\u003e '.'\n\n\n^Als/Path:extname[index]\n#--\u003e ''\n\n\n^Als/Path:extname[.index]\n#--\u003e ''\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: format\n\nThe `^Als/Path:format[]` method returns a path string from an `\u003chash\u003e`. This is the opposite of [`^Als/Path:parse[]`](#method-parse).\n\n---\n\n### Syntax\n\n`^Als/Path:format[hPath]`\n\n### Params\n\n* $hPath `\u003chash\u003e`\n\t* $.dir `\u003cstring\u003e`\n\t* $.root `\u003cstring\u003e`\n\t* $.base `\u003cstring\u003e`\n\t* $.name `\u003cstring\u003e`\n\t* $.ext `\u003cstring\u003e`\n\n---\n\nThe following process is used when constructing the path string:\n- `$result` is set to an empty string.\n- If `$.dir[]` is specified, `$.dir[]` is appended to `$result` followed by the value of [`$Als/Path:separator`](#property-separator);\n- Otherwise, if `$.root[]` is specified, `$.root[]` is appended to `$result`.\n- If `$.base[]` is specified, `$.base[]` is appended to `$result`;\n- Otherwise:\n\t- If `$.name[]` is specified, `$.name[]` is appended to `$result`\n\t- If `$.ext[]` is specified, `$.ext[]` is appended to `$result`.\n- Return `$result`\n\n### Example\n\n```ruby\n# If 'dir' and 'base' are provided:\n# ${dir}${separator}${base}\n# will be returned.\n^Als/Path:format[\n\t$.dir[/home/user/dir]\n\t$.base[file.txt]\n]\n//--\u003e '/home/user/dir/file.txt'\n\n\n# 'root will be used if 'dir' is not specified.\n# If only 'root' is provided or 'dir' is equal to 'root'\n# then the separator will not be included.\n^Als/Path:format[\n\t$.root[/]\n\t$.base[file.txt]\n]\n#--\u003e '/file.txt'\n\n\n# `name` + `ext` will be used if `base` is not specified.\n^Als/Path:format[\n\t$.root[/]\n\t$.name[file]\n\t$.ext[.txt]\n]\n#--\u003e '/file.txt'\n\n\n# `base` will be returned if `dir` or `root` are not provided.\n^Als/Path:format[\n\t$.base[file.txt]\n]\n#--\u003e 'file.txt'\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: isAbsolute\n\nThe `^Als/Path:isAbsolute[]` method determines if `path` is an absolute path.\n\nIf the given `path` is a zero-length string, `false` will be returned.\n\n---\n\n### Syntax\n\n`^Als/Path:isAbsolute[path]`\n\n### Params\n\n* path `\u003cstring\u003e`\n\n### Example\n\n```ruby\n^Als/Path:isAbsolute[/foo/bar]\n#--\u003e true\n\n\n^Als/Path:isAbsolute[/baz/..]\n#--\u003e true\n\n\n^Als/Path:isAbsolute[qux/]\n#--\u003e false\n\n\n^Als/Path:isAbsolute[.]\n#--\u003e false\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: join\n\nThe `^Als/Path:join[]` method join all given `path` segments together using the [`$Als/Path:separator`](#property-separator) as a delimiter, then [@normalize](#method-normalize)s the resulting path.\n\nZero-length `path` segments are ignored. If the joined path string is a zero-length string then `'.'` will be returned, representing the current working directory.\n\n---\n\n### Syntax\n\n`^Als/Path:join[path1;path2[;...]]`\n\n### Params\n\n* path[, ...] `\u003cstring\u003e` A sequence of path segments.\n\n### Example\n\n```ruby\n^Als/Path:join[/foo;bar;baz/asdf;quux;..]\n#--\u003e '/foo/bar/baz/asdf'\n\n\n^Als/Path:join[foo; $.path[123] ;bar]\n#--\u003e throws 'invalid.argument' error.\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: normalize\n\nThe `^Als/Path:normalize[]` method normalizes the given `path`, resolving `'..'` and `'.'` segments.\n\nWhen multiple, sequential path segment separation characters are found, they are replaced by a single instance of the path segment separator. Trailing separators are preserved.\n\nIf the path is a zero-length string, `'.'` is returned, representing the current working directory.\n\n---\n\n### Syntax\n\n`^Als/Path:normalize[path]`\n\n### Params\n\n* path `\u003cstring\u003e`\n\n### Example\n\n```ruby\n^Als/Path:normalize[/foo/bar//baz/asdf/quux/..]\n#--\u003e '/foo/bar/baz/asdf'\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: parse\n\nThe `^Als/Path:parse[]` method returns an `\u003chash\u003e` whose properties represent significant elements of the path.\n\nThe returned `\u003chash\u003e` will have the following properties:\n\n* $.root `\u003cstring\u003e`\n* $.dir `\u003cstring\u003e`\n* $.base `\u003cstring\u003e`\n* $.ext `\u003cstring\u003e`\n* $.name `\u003cstring\u003e`\n\n---\n\n### Syntax\n\n`^Als/Path:parse[path]`\n\n### Params\n\n* path `\u003cstring\u003e`\n\n### Example\n\n```ruby\n^Als/Path:parse[/home/user/dir/file.txt]\n#--\u003e\n#  $.root[/]\n#  $.dir[/home/user/dir]\n#  $.base[file.txt]\n#  $.ext[.txt]\n#  $.name[file]\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: relative\n\nThe `^Als/Path:relative[]` method returns the relative path from `from` to `to`. If `from` and `to` each resolve to the same path (after calling [`^Als/Path:resolve[]`](#method-resolve) on each), a zero-length string is returned.\n\nIf a zero-length string is passed as `from` or `to`, the current working directory will be used instead of the zero-length strings.\n\n---\n\n### Syntax\n\n`^Als/Path:relative[from;to]`\n\n### Params\n\n* from `\u003cstring\u003e`\n* to `\u003cstring\u003e`\n\n### Example\n\n```ruby\n^Als/Path:relative[/home/user/test/aaa;/home/user/impl/bbb]\n#--\u003e '../../impl/bbb'\n```\n\n--------------------------------------------------------------------------------\n\n## @METHOD: resolve\n\nThe `^Als/Path:resolve[]` method resolves a sequence of paths or path segments into an absolute path.\n\nThe given sequence of paths is processed from right to left, with each subsequent `path` prepended until an absolute path is constructed. For instance, given the sequence of path segments: `/foo`, `/bar`, `baz`, calling  `^Als/Path:resolve[/foo;/bar;baz]` would return `/bar/baz`.\n\nIf after processing all given `path` segments an absolute path has not yet been generated, the current working directory is used.\n\nThe resulting path is normalized and trailing slashes are removed unless the path is resolved to the root directory.\n\nZero-length `path` segments are ignored.\n\nIf no `path` segments are passed, `^Als/Path:resolve[]` will return the absolute path of the current working directory.\n\n---\n\n### Syntax\n\n`^Als/Path:resolve[[path[; ...]]`\n\n### Params\n\n* path[, ...] `\u003cstring\u003e` A sequence of paths or path segments\n\n### Example\n\n```ruby\n^Als/Path:resolve[/foo/bar;./baz]\n#--\u003e '/foo/bar/baz'\n\n\n^Als/Path:resolve[/foo/bar;/tmp/file/]\n#--\u003e '/tmp/file'\n\n\n# if the current working directory is '/home/myself/node'\n^Als/Path:resolve[wwwroot;static_files/png/;../gif/image.gif]\n#--\u003e '/home/myself/node/wwwroot/static_files/gif/image.gif'\n```\n\n---\n\n---\n\n## References\n\n- Questions to Leonid Knyazev \u003cleonid@knyazev.me\u003e | \u003cn3o@design.ru\u003e\n- Bug reports and Feature requests to Issues.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparser3%2Fals.path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparser3%2Fals.path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparser3%2Fals.path/lists"}