This mimics the bash pushd/popd functions. When changing a directory the
pushd will place the current directory onto a stack and then change to the requested directory. When
popd is called, then the previous directory is restored from the top of that stack. This is a way to simplify backtracking through a directory hierarchy.
This module uses yarn to manage dependencies and run scripts for development.
To install as a global package and cli:
$ yarn global add util.chdir
To install as a development dependency with cli:
$ yarn add --dev util.chdir
To build the app and run all tests:
$ yarn run all
const chdir = require('util.chdir'); // assume directory is /home chdir.pushd('/tmp'); // pushes /home on the stack and changes to /tmp chdir.popd(); // pops the top of the stack and switches to that directory