Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
tildify
Advanced tools
Convert an absolute path to a tilde path: `/Users/sindresorhus/dev` → `~/dev`
Weekly downloads
Package description
The tildify npm package is used to convert absolute paths into a tilde path, which replaces the user's home directory with a tilde (~). This can be useful for displaying paths in a more readable and user-friendly format, especially in command-line applications or logging.
Convert absolute path to tilde path
This feature takes an absolute path and converts it to a tilde path by replacing the user's home directory with a tilde (~).
const tildify = require('tildify');
const tildePath = tildify('/Users/username/project');
console.log(tildePath); // Outputs: '~/project'
The untildify package performs the opposite action of tildify. It converts a tilde path back into an absolute path by expanding the tilde (~) to the user's home directory.
The user-home package is used to get the current user's home directory. While it does not convert paths, it provides the base functionality that packages like tildify rely on to replace the home directory with a tilde.
Similar to user-home, os-homedir is used to get the user's home directory. It's a low-level utility that can be used in conjunction with other packages to manipulate paths.
Readme
Convert an absolute path to a tilde path:
/Users/sindresorhus/dev
→~/dev
$ npm install tildify
import tildify from 'tildify';
tildify('/Users/sindresorhus/dev');
//=> '~/dev'
See untildify for the inverse.
FAQs
Convert an absolute path to a tilde path: `/Users/sindresorhus/dev` → `~/dev`
The npm package tildify receives a total of 1,378,630 weekly downloads. As such, tildify popularity was classified as popular.
We found that tildify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.