prepend-cwd
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

prepend-cwd

Prepend the CWD to a path

Travis npm

Use this if you need a path to always be absolute, but the input you're getting could be relative or absolute.

Installation

npm install prepend-cwd

Usage

const cwd = require('prepend-cwd');
 
cwd('cat.png'); // => /Users/geoff/sites/project/cat.png
cwd('/Users/geoff/sites/project/cat.png') // => /Users/geoff/sites/project/cat.png

API

cwd(path)

Prepend the current working directory to a path, unless the path is absolute, in which case return it as-is.

  • path (String): path to prepend to.

Returns absolute path.

Local Development

git clone https://github.com/gakimball/prepend-cwd
cd prepend-cwd
npm install
npm test

License

MIT © Geoff Kimball

/prepend-cwd/

    Package Sidebar

    Install

    npm i prepend-cwd

    Weekly Downloads

    2

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    3.57 kB

    Total Files

    5

    Last publish

    Collaborators

    • gakimball