Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

deepsweet/move-path

Repository files navigation

move-path

⚠️ Project has been transferred to NexTools metarepo

npm linux windows coverage

Move path to destination folder.

Requirements

  • Node.js >= 8.6.0

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