Insert a path into another path
npm install path-insert
const pathInsert = require('path-insert');
const path = '/Users/geoff/Videos/secret-videos/puppers/doggo.mov';
pathInsert.start(path, '/Users/geoff/Videos', 'real-secret-videos');
// => '/Users/geoff/Videos/real-secret-videos/secret-videos/puppers/doggo.mov'
pathInsert.end(path, 'secret-videos/puppers/doggo.mov', 'real-secret-videos');
// => '/Users/geoff/Videos/real-secret-videos/secret-videos/puppers/doggo.mov'
Insert a string in the middle of a path, using a segment at the base of the path as the target.
- path (String): Full path.
- base (String): Path segment to insert
replacement
after. - insert (String): Path segment to insert.
Returns a modified path with insert
inserted into string
.
Insert a string in the middle of a path, using a segment at the end of the path as the target.
- path (String): Full path.
- end (String): Path segment to insert
replacement
before. - insert (String): Path segment to insert.
Returns a modified path with insert
inserted into string
.
git clone https://github.com/gakimball/path-insert
cd path-insert
npm install
npm test
MIT © Geoff Kimball