JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 293
  • Score
    100M100P100Q72151F
  • License Unlicense

Convert a path to an absolute tilde path

Package Exports

  • tilde-path

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tilde-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tilde-path

NPM version Build Status Build status Coverage Status Dependency Status devDependency Status

A Node module to convert a path to an absolute tilde path

// On /User/shinnn/project
const tildePath = require('tilde-path');

tildePath('foo'); //=> '~/project/foo'
tildePath('foo/bar'); //=> '~/project/foo/bar'
tildePath('../'); //=> '~'

Installation

Use npm.

npm install tilde-path

API

const tildePath = require('tilde-path');

tildePath(path)

path: String
Return: String

It converts a given path to an absolute path if it's relative, then converts it to a tilde path.

tildePath('.'); //=> '~/current/path'
tildePath(''); //=> '~/current/path'
tildePath('foo/../bar/../////baz/..'); //=> '~/current/path'

tildePath('/Users/shinnn/already/absolute'); //=> '~/already/absolute'
tildePath('/Outside/home/dir'); //=> '/Outside/home/dir'

License

The Unlicense