{"id":17472617,"url":"https://github.com/shinnn/tilde-path","last_synced_at":"2025-03-28T08:10:02.122Z","repository":{"id":65412400,"uuid":"63150328","full_name":"shinnn/tilde-path","owner":"shinnn","description":"Convert a path to an absolute tilde path","archived":false,"fork":false,"pushed_at":"2019-04-12T14:42:27.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T22:45:46.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-12T10:49:14.000Z","updated_at":"2019-04-12T14:42:29.000Z","dependencies_parsed_at":"2023-01-22T07:55:25.060Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/tilde-path","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Ftilde-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Ftilde-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Ftilde-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Ftilde-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/tilde-path/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991582,"owners_count":20706129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-18T17:29:08.905Z","updated_at":"2025-03-28T08:10:02.086Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tilde-path\n\n[![npm version](https://img.shields.io/npm/v/tilde-path.svg)](https://www.npmjs.com/package/tilde-path)\n[![Build Status](https://travis-ci.com/shinnn/tilde-path.svg?branch=master)](https://travis-ci.com/shinnn/tilde-path)\n[![codecov](https://codecov.io/gh/shinnn/tilde-path/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/tilde-path)\n\nResolve a path into an absolute path, using [tilde (`~`)](https://www.gnu.org/software/libc/manual/html_node/Tilde-Expansion.html) if possible\n\n```javascript\n// On /Users/shinnn/project\nconst tildePath = require('tilde-path');\n\ntildePath('foo'); //=\u003e '~/project/foo'\ntildePath('foo/bar'); //=\u003e '~/project/foo/bar'\ntildePath('../'); //=\u003e '~'\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).\n\n```\nnpm install tilde-path\n```\n\n## API\n\n```javascript\nconst tildePath = require('tilde-path');\n```\n\n### tildePath(*path*)\n\n*path*: `string`  \nReturn: `string`\n\nOn a non-Windows environment,\n\n1. Resolves a given path into an absolute path if it's relative\n2. Replaces the [home directory](https://nodejs.org/api/os.html#os_os_homedir) path with `~`\n\nOn Windows, it just calls [`path.win32.resolve`](https://nodejs.org/api/path.html#path_path_resolve_paths) because Windows [doesn't support tilde home path](https://superuser.com/a/60421).\n\n```javascript\n// On POSIX\ntildePath('my/dir'); //=\u003e '~/my/dir'\n\n// On Windows\ntildePath('my/dir'); //=\u003e 'C:\\\\Users\\\\shinnn\\\\my\\\\dir'\n```\n\n## License\n\n[ISC License](./LICENSE) © 2018 - 2019 Shinnosuke Watanabe\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Ftilde-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Ftilde-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Ftilde-path/lists"}