move-path
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

move-path npm

Move path to destination folder.

Install

$ yarn add move-path

Usage

movePath(from, to)

Handles both relative and absolute from and to and returns an absolute destination path.

import movePath from 'move-path'
 
movePath('src/foo/bar/index.js', 'build/baz/')
// /absolute/build/baz/foo/bar/index.js
 
movePath('src/foo/bar/', 'build/baz/')
// /absolute/build/baz/foo/bar/
 
movePath('src/foo/bar/index.js', 'src/foo/')
// /absolute/src/foo/bar/index.js
 
movePath('src/foo/bar/', 'src/foo/bar')
// /absolute/src/foo/bar/
 
movePath('src/foo/bar/index.js', '/build/')
// /build/foo/bar/index.js
 
movePath('src/foo/bar/index.js', './')
// /absolute/src/foo/bar/index.js

Readme

Keywords

Package Sidebar

Install

npm i move-path

Weekly Downloads

34

Version

2.0.0

License

MIT

Unpacked Size

3.6 kB

Total Files

5

Last publish

Collaborators

  • deepsweet
  • fosimus
  • psxcode